Skip to content
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

golangci-lint doesn't seem to make use of RelatedInformation #1189

Closed
3 tasks done
mpictor opened this issue Jun 17, 2020 · 1 comment · Fixed by #1773
Closed
3 tasks done

golangci-lint doesn't seem to make use of RelatedInformation #1189

mpictor opened this issue Jun 17, 2020 · 1 comment · Fixed by #1773
Labels
enhancement New feature or improvement

Comments

@mpictor
Copy link

mpictor commented Jun 17, 2020

Thank you for creating the issue!

  • Yes, I'm using a binary release within 2 latest major releases. Only such installations are supported.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc).

Please include the following information:

Version of golangci-lint
$ golangci-lint --version
golangci-lint has version 1.27.0 built from fb74c2e on 2020-05-13T18:48:26Z
Config file

N/A

Go environment
$ go version && go env
go version go1.14.1 linux/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/mark/.cache/go-build"
GOENV="/home/mark/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/mark/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build017019077=/tmp/go-build -gno-record-gcc-switches"

See the last comments on dominikh/go-tools#641

Copying Dominik's response here:

when running staticcheck on this function

func fn(x *byte) {
	println(*x)
	if x != nil {
		return
	}
}

it outputs the following diagnostic

foo.go:4:10: possible nil pointer dereference (SA5011)
	foo.go:5:5: this check suggests that the pointer can be nil

pointing at both the dereference, as well as the relevant nil pointer check.

It seems that golangci-lint neglects to point at the actual check:

foo.go:4:10: SA5011: possible nil pointer dereference (staticcheck)
	println(*x)

This is an issue in golangci-lint, not staticcheck. In go/analysis terms, golangci-lint doesn't seem to make use of RelatedInformation.

@mpictor mpictor added the bug Something isn't working label Jun 17, 2020
@boring-cyborg
Copy link

boring-cyborg bot commented Jun 17, 2020

Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors.

@sayboras sayboras added enhancement New feature or improvement good first issue Good for newcomers help wanted Issue that needs help from a contributor and removed bug Something isn't working labels Jun 26, 2020
@ldez ldez removed help wanted Issue that needs help from a contributor good first issue Good for newcomers labels Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants