golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
123.86k stars 17.65k forks source link

x/tools/cmd/fiximports: tests failing at tip #17417

Open bradfitz opened 8 years ago

bradfitz commented 8 years ago

At tip, the tests for golang.org/x/tools/cmd/fiximports are failing.

It's not immediately obvious to me why. I'd never seen this tool before.

@alandonovan, can you take a look?

gopherbot commented 8 years ago

CL https://golang.org/cl/30953 mentions this issue.

alandonovan commented 8 years ago

The following packages beneath $GOROOT have a non-empty ImportComment that differs from their ImportPath:

ImportPath                              ImportComment
vendor/golang_org/x/net/idna            golang.org/x/net/idna
vendor/golang_org/x/text/transform      golang.org/x/text/transform
vendor/golang_org/x/text/unicode/norm   golang.org/x/text/unicode/norm
vendor/golang_org/x/text/width          golang_org/x/text/width
golang.org/x/arch/vendor/rsc.io/pdf     rsc.io/pdf

I'm not sure what the correct behavior of fiximports should be in the presence of vendored packages. Inspecting only the suffix of the ImportPath after vendor/ is not sufficient due to the dot-to-slash renaming that has apparently happened. Perhaps the tool should just ignore any packages whose ImportPath contains vendor?

@rsc Does anyone actually use this tool?

agnivade commented 5 years ago

@alandonovan - If nobody uses this tool, then I think ignoring vendor paths may be the easiest solution.

ping @rsc for further comments.