x/tools/go/analysis/passes/shadow/cmd/shadow: Failure/success of the linter depends also on filename, not just the content #40758
Labels
Analysis
Issues related to static analysis (vet, x/tools/go/analysis)
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Install shadow vet:
$ go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow
Create following files:
+$ tree .
.
├── b.go
├── c.go
└── go.mod
0 directories, 3 files
+$ cat b.go
package foo
func newX() int {
x := 1
return x
}
var x = newX()
+$ cat c.go
package foo
func f() {
x = 1
}
+$ cat go.mod
module foo
go 1.14
Run the shadow vet:
$ go vet -vettool=/home/wolf/go/bin/shadow ./...
What did you expect to see?
What did you see instead?
Nothing.
Some research notes
It looks like shadow vet depends on the filenames, because all one needs to do
to get the expected output is to rename
c.go
toa.go
, so when sorted byalphabet is is before
b.go
. My understanding is that the package is thescope, so alphabetic ordering of the files should not matter.
The text was updated successfully, but these errors were encountered: