Open hxiaodon opened 9 months ago
We are using the singlechecker
package from x/tools
package: https://pkg.go.dev/golang.org/x/tools/go/analysis/singlechecker, and the flags you see there are not directly related to NilAway (populated by the singlechecker linter driver).
Here it seems that the singlechecker does not have proper support for build tags and we have very little control over that since singlechecker
takes the entire main function entry away and handles the package loading logic (other than writing our own linter driver of course). There has been https://github.com/golang/go/issues/61324 that tries to implement an importable checker driver API, which would provide some flexibilities to configure the package loader. We are waiting for that to be available.
In the meantime, we can also hack around to see if it's possible to fix this (feel free to do so yourself and send a PR 😃 ). I'm keeping this issue open to track this.
I tried running nilaway cmd for our internal project, but it failed with the following error
settings.XXXXX is indeed defined in a source file with "//go:build $flagname" statement declared at the first line
The golangci-lint has the build-flag option while nilaway's analyzer deprecated it
Any suggestion for this issue? Thanks~