-
-
Notifications
You must be signed in to change notification settings - Fork 67
chore: demonstrate golangci-lint not working with deps #145
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
base: main
Are you sure you want to change the base?
chore: demonstrate golangci-lint not working with deps #145
Conversation
I get an error like below when I run bazel lint src:hello_go as a result of the go_binary depending on another go target this is a demo of aspect-build#129 INFO: Analyzed target //src:hello_go (0 packages loaded, 0 targets configured). INFO: From golangcilint src/golangcilint.hello_go.aspect_rules_lint.report: level=warning msg="[runner] Can't run linter goanalysis_metalinter: buildir: failed to load package : could not load export data: no export data for \"gopher\"" level=error msg="Running error: 1 error occurred:\n\t* can't run linter goanalysis_metalinter: buildir: failed to load package : could not load export data: no export data for \"gopher\"\n\n"
ecacb26
to
6c633ef
Compare
However this isn't sufficient yet for the Go tool to locate these files
note, #207 killed golangci-lint for now, happy to keep this PR open for the repro when it's time to try again |
# into the GOROOT folder. | ||
# https://github.com/bazelbuild/rules_go/blob/c0ef535977f9fd2d9a67243552cd04da285ab629/extras/gomock.bzl#L37-L55 | ||
# suggests that we have to copy files around? | ||
gopath = go_ctx.sdk.root_file.dirname |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of reimplementing this here, should this come from a go_path target @alexeagle?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, quite possibly, I haven't studied the rules available in rules_go recently.
Is it something you could help with? I can do some of the work to wire up tests, parsing SARIF output, applying suggested fixes as patches, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure yet. I am converting a repo to bzlmod which uses staticanalyzers. I am investigating sluongng/nogo-analyzer#40 currently. I believe the approach is different. nogo seems to directly plug into go compilation like error prone does in Java.
Steps to reproduce:
cd example
bazel lint src:hello_go
Expected result would be successful linting. Actual is below. This seems to come about because the go_binary depends on a go_library
this is a demo of #129
INFO: Analyzed target //src:hello_go (0 packages loaded, 0 targets configured).
INFO: From golangcilint src/golangcilint.hello_go.aspect_rules_lint.report:
level=warning msg="[runner] Can't run linter goanalysis_metalinter: buildir: failed to load package : could not load export data: no export data for "gopher""
level=error msg="Running error: 1 error occurred:\n\t* can't run linter goanalysis_metalinter: buildir: failed to load package : could not load export data: no export data for "gopher"\n\n"