-
-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc: staticcheck README #14
Conversation
Sounds plausible but i would appreciate if you could help providing a minimal test similar to https://github.com/sluongng/nogo-analyzer/blob/master/staticcheck/tests/staticcheck_test.go Worth to note that the current way this is setting up rules_go is using the template here https://github.com/bazelbuild/rules_go/blob/8d6b21cbd13131e05be1626376c9af160517c264/go/tools/bazel_testing/bazel_testing.go#L463 so you most likely will have to provide the whole WORKSPACE file in the test. |
3474039
to
764b151
Compare
Turned out loading |
I am not convinced that is the case.
So unless you have a broken loading-and-analysis run and tell bazel to proceed ignoring errors (i.e. with Although I do agree that the best practice should be to load
In practice, I think bazel is smart enough to load these in order of dependency rather than declarative ordering and things should still work. I.e. in this current project I am declaring most go_repository before register toolchains Line 48 in 50be7f8
With that said, I think this PR does make the doc a bit clearer. So let me modify the commit message a bit and merge it. |
Thinking back, I wonder if the issue you ran into related to the result of |
I discovered that working on test example for this PR. If you interested here it is: |
@heartless-clown very helpful example, much appreciated After testing, I realized this: Here is your original
which failed the test with
However if you change from this
to this
Which only move the This is definitely a lot mental gymnastic to think about, but it seems to be an issue with bazel or rules_go specifically. |
It is actually critical to load
staticcheck_deps()
beforego_register_toolchains()
, but aftergo_rules_dependencies()
, if you have any conflictinggo_repository
dependencies.I ran into an issue with the project that requires
github.com/grpc-ecosystem/grpc-gateway/v2 v2.10.3
(witch depends onhonnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc
).For some reason just loading
staticcheck_deps()
before mygo_deps()
didn't do the work.If needed example repo can be provided.