atlassian / bazel-tools

Reusable bits for Bazel
Apache License 2.0
113 stars 36 forks source link

golangcilint: errors on generated file imports #89

Closed johanbrandhorst closed 4 years ago

johanbrandhorst commented 4 years ago

Hi! I've been trying to use golangcilint on a bazel model repo I'm working on and one of the checks is failing to find generated imports:

service/go-client/main.go:45:19: NewUserServiceClient not declared by package users (typecheck)
    users := pbUsers.NewUserServiceClient(cc)

users is a generated protobuf package.

Full log here: https://app.circleci.com/pipelines/github/johanbrandhorst/bazel-mono/18/workflows/da9da62e-24a3-4417-bc09-1761b51abe75/jobs/128/steps

It's reproducible locally.

ash2k commented 4 years ago

Yes, this is expected. The way it works is not compatible with generated code. I recommend to move to https://github.com/bazelbuild/rules_go/blob/master/go/nogo.rst

I'll update the docs to point that out.

johanbrandhorst commented 4 years ago

Ah, good to know. You're the second person to point me towards nogo, sounds like a plan!