Skip to content
This repository has been archived by the owner on Apr 10, 2019. It is now read-only.

gometalinter warnings for go 1.11 #564

Closed
LPX-E5BD8 opened this issue Dec 7, 2018 · 5 comments
Closed

gometalinter warnings for go 1.11 #564

LPX-E5BD8 opened this issue Dec 7, 2018 · 5 comments

Comments

@LPX-E5BD8
Copy link

How can I ignore the warning for go source code?

../../../../../../../../usr/local/go/src/internal/cpu/cpu_x86.go:9:7:warning: CacheLineSize redeclared in this block (interfacer)
../../../../../../../../usr/local/go/src/internal/cpu/cpu_wasm.go:7:7:warning: other declaration of CacheLineSize (interfacer)
../../../../../../../../usr/local/go/src/runtime/internal/atomic/atomic_wasm.go:14:6:warning: Load redeclared in this block (interfacer)
../../../../../../../../usr/local/go/src/runtime/internal/atomic/atomic_amd64x.go:13:6:warning: other declaration of Load (interfacer)
../../../../../../../../usr/local/go/src/runtime/internal/atomic/atomic_wasm.go:20:6:warning: Loadp redeclared in this block (interfacer)
../../../../../../../../usr/local/go/src/runtime/internal/atomic/atomic_amd64x.go:19:6:warning: other declaration of Loadp (interfacer)
../../../../../../../../usr/local/go/src/runtime/internal/atomic/atomic_wasm.go:26:6:warning: Load64 redeclared in this block (interfacer)
../../../../../../../../usr/local/go/src/runtime/internal/atomic/atomic_amd64x.go:25:6:warning: other declaration of Load64 (interfacer)
../../../../../../../../usr/local/go/src/runtime/internal/atomic/atomic_wasm.go:32:6:warning: Xadd redeclared in this block (interfacer)
../../../../../../../../usr/local/go/src/runtime/internal/atomic/atomic_amd64x.go:30:6:warning: other declaration of Xadd (interfacer)
../../../../../../../../usr/local/go/src/runtime/internal/atomic/atomic_wasm.go:40:6:warning: Xadd64 redeclared in this block (interfacer)
../../../../../../../../usr/local/go/src/runtime/internal/atomic/atomic_amd64x.go:33:6:warning: other declaration of Xadd64 (interfacer)
../../../../../../../../usr/local/go/src/runtime/internal/atomic/atomic_wasm.go:48:6:warning: Xadduintptr redeclared in this block (interfacer)
../../../../../../../../usr/local/go/src/runtime/internal/atomic/atomic_amd64x.go:36:6:warning: other declaration of Xadduintptr (interfacer)
../../../../../../../../usr/local/go/src/runtime/internal/atomic/atomic_wasm.go:56:6:warning: Xchg redeclared in this block (interfacer)
../../../../../../../../usr/local/go/src/runtime/internal/atomic/atomic_amd64x.go:39:6:warning: other declaration of Xchg (interfacer)
@LPX-E5BD8
Copy link
Author

➜  ~ ✗ go version
go version go1.11.2 darwin/amd64
➜  ~✗ go env
GOARCH="amd64"
GOBIN="xxxxxxxx"
GOCACHE="xxxxxx"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="xxxxxxxx"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
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/cc/svj80j9x127_fjykjkm0sc540000gn/T/go-build539747050=/tmp/go-build -gno-record-gcc-switches -fno-common"

@oschwald
Copy link

I am also experiencing this after upgrading from 1.10 to 1.11.3.

@oschwald
Copy link

#149 seems related and has some possible solutions.

@vendion
Copy link

vendion commented Jan 3, 2019

I'm seeing something similar to this where the linters run against go modules that my app imports.

$ gometalinter .
../../gocode/pkg/mod/go.uber.org/[email protected]/config.go:140:27:warning: DefaultLineEnding not declared by package zapcore (gosimple)
../../gocode/pkg/mod/go.uber.org/[email protected]/config.go:140:27:warning: parameter DefaultLineEnding not declared by package zapcore (unparam)
../../gocode/pkg/mod/go.uber.org/[email protected]/config.go:140:3:warning: parameter unknown field LineEnding in struct literal (unparam)
../../gocode/pkg/mod/go.uber.org/[email protected]/config.go:101:27:warning: parameter DefaultLineEnding not declared by package zapcore (unparam)
../../gocode/pkg/mod/go.uber.org/[email protected]/config.go:101:3:warning: parameter unknown field LineEnding in struct literal (unparam)
../../gocode/pkg/mod/go.uber.org/[email protected]/level.go:131:21:warning: parameter invalid operation: MarshalText is not in method set of go.uber.org/zap/zapcore.Level (unparam)

Output from go env and gometalinter --version

$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/vendion/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/vendion/gocode"
GOPROXY=""
GORACE=""
GOROOT="/usr/lib/go"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/vendion/work/JuiceAPI/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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build849620644=/tmp/go-build -gno-record-gcc-switches"
$ gometalinter --version
gometalinter version 2.0.12 built from 102ac984005d45456a7e3ae6dc94ebcd95c2bb19 on 2018-12-16T00:57:56Z

Manually excluding $GOPATH/pkg/mod directory seems to work though.

@dnephin
Copy link
Collaborator

dnephin commented Jan 3, 2019

#562 (comment)

I believe the problem is that the linter uses https://godoc.org/golang.org/x/tools/go/loader (or some other library) that does not understand go modules. All the linters will need to be updated to use https://godoc.org/golang.org/x/tools/go/packages and then we will need to update the vendored copy of the linter. Once that is done it will work with go modules.

Until then you'll have to go mod vendor and run with GOMODULE111=off.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants