grpc-go: go vet says Errorf calls are all wrong, "constant 1 not a string in call to Errorf"
go vet seems assume that Errorf first arg would be format string
$ cat main.go
package main
import (
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
)
func main() {
_ = grpc.Errorf(codes.Canceled, "i have nothing more to say")
}
$ go vet main.go
main.go:9: constant 1 not a string in call to Errorf
exit status 1
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Reactions: 2
- Comments: 15 (5 by maintainers)
It’s kinda ridiculous that
go vet
won’t get fixed and you guys don’t wanna change your usage that foolsgo vet
either… It’s a big pain in the ass for those of us who usego vet
, which should be considered best practice.If anyone else runs into this, here’s a workaround:
For posterity, this issue has been resolved in
go vet
in https://github.com/golang/go/issues/12294 and will be available in Go 1.7.