Skip to content

False goimports positives #549

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

Closed
fiunchinho opened this issue May 27, 2019 · 4 comments
Closed

False goimports positives #549

fiunchinho opened this issue May 27, 2019 · 4 comments
Labels
false positive An error is reported when one does not exist

Comments

@fiunchinho
Copy link

fiunchinho commented May 27, 2019

Trying to run golangci-lint, it complains about goimports not being applied on some files, but running goimports on those files makes no difference: it still complains about it.

$ GO111MODULE=off golangci-lint run --disable-all -E goimports
src/archiver/test/fake_sink.go:8: File is not `goimports`-ed (goimports)
$ GO111MODULE=off go version && go env
go version go1.12.5 darwin/amd64
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/jose.armesto/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/jose.armesto/dev"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/opt/go/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/opt/go/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/jose.armesto/dev/src/github.com/company/project/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/s1/b2s7pp8j7mb3pb6ph8gbv2sc0000gn/T/go-build498201237=/tmp/go-build -gno-record-gcc-switches -fno-common"
@alexkohler
Copy link

How are you running goimports on the file? Are you passing the -w flag?

If so, do you have multiple versions of goimports installed? What is the output of which -a goimports?

@fiunchinho
Copy link
Author

fiunchinho commented May 28, 2019

I'm not passing the -w flag, just checking the output.

I don't think I have multiple versions installed

which -a
$GOPATH/bin/goimports

@markus-wa
Copy link
Contributor

Is this maybe related to #387?

Since it doesn't look like 81cf487 fixed that issue (see my comment on #387)

@tpounds tpounds added the false positive An error is reported when one does not exist label Sep 25, 2019
@jirfag
Copy link
Contributor

jirfag commented Oct 14, 2019

Hi, please, update goimports.
Also, use golangci-lint run --fix to fix goimports issues

@jirfag jirfag closed this as completed Oct 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
false positive An error is reported when one does not exist
Projects
None yet
Development

No branches or pull requests

5 participants