feat: careful spf13/cast

main
sudo pacman -Syu 2022-10-26 21:33:20 +07:00
parent 326c1c9482
commit aea41a6ace
No known key found for this signature in database
GPG Key ID: D6CB5C6C567C47B0
1 changed files with 12 additions and 0 deletions

View File

@ -223,6 +223,18 @@ Example with `matryer/moq`:
//go:generate sh -c "test service_mock_generated.go -nt $GOFILE && exit 0; moq -rm -out service_mock_generated.go . Service"
```
### Be careful with [spf13/cast](https://github.com/spf13/cast)
Don't cast proto enum:
```golang
// Don't
a := cast.ToInt32(servicev1.ReasonCode_ABC)
// Do
a := int32(servicev1.ReasonCode_ABC)
```
### Replace `go fmt`, `goimports` with [mvdan/gofumpt](https://github.com/mvdan/gofumpt).
`gofumpt` provides more rules when format Go codes.