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

x/tools/go/analysis/passes/nilness: missing location for error in embedded struct #51986

Closed
yuki2006 opened this issue Mar 28, 2022 · 2 comments
Labels
Analysis Issues related to static analysis (vet, x/tools/go/analysis) FrozenDueToAge 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

Comments

@yuki2006
Copy link

What version of Go are you using (go version)?

$ go version
go version go1.17.7 darwin/arm64

Does this issue reproduce with the latest release?

yes ( v0.1.10 )

What operating system and processor architecture are you using (go env)?

go env Output
$ go env

GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/yuki/Library/Caches/go-build"
GOENV="/Users/yuki/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/yuki/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/yuki/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.17.7"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/yuki/gopath/src/go-test/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 -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/00/79n00m9j66zf77ppbmrzg_300000gn/T/go-build438069086=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

go install golang.org/x/tools/go/analysis/passes/nilness/cmd/nilness@latest

put main.go

package main

import "fmt"

type dummy struct {
	innerDummy
}

type innerDummy struct {
	value int
}

func main() {
	var d *dummy
	fmt.Println(d.value)
}

nilness ./...

What did you expect to see?

The correct error location is displayed.

What did you see instead?

-: nil dereference in field selection
@yuki2006 yuki2006 changed the title nilness: In the case of an inherited structure error, the display is wrong. tools/nilness: In the case of an inherited structure error, the display is wrong. Mar 28, 2022
@ianlancetaylor ianlancetaylor changed the title tools/nilness: In the case of an inherited structure error, the display is wrong. x/tools/go/analysis/passes/nilness: missing location for error in embedded struct Mar 28, 2022
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Mar 28, 2022
@gopherbot gopherbot added this to the Unreleased milestone Mar 28, 2022
@ianlancetaylor ianlancetaylor added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Mar 28, 2022
@zpavlinovic zpavlinovic added the Analysis Issues related to static analysis (vet, x/tools/go/analysis) label Mar 28, 2022
@zpavlinovic
Copy link
Contributor

Related issue #31008

@zpavlinovic zpavlinovic self-assigned this Mar 29, 2022
@gopherbot
Copy link

Change https://go.dev/cl/396495 mentions this issue: go/ssa: adds position info to implicit field selection instructions

@golang golang locked and limited conversation to collaborators Jun 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Analysis Issues related to static analysis (vet, x/tools/go/analysis) FrozenDueToAge 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.
Projects
None yet
Development

No branches or pull requests

4 participants