chore: demonstrate golangci-lint not working with deps#145
chore: demonstrate golangci-lint not working with deps#145srabraham wants to merge 2 commits intoaspect-build:mainfrom
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.
Instead of reimplementing this here, should this come from a go_path target @alexeagle?
There was a problem hiding this comment.
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.
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 examplebazel lint src:hello_goExpected 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"