-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.
Milestone
Description
What version of Go are you using (go version
)?
go version devel +a0e7f12771 Sat Sep 29 10:07:58 2018 +0000 linux/amd64
Does this issue reproduce with the latest release?
Yes - checked 1.11.
What operating system and processor architecture are you using (go env
)?
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/mvdan/go/cache"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/mvdan/go/land:/home/mvdan/go"
GOPROXY=""
GORACE=""
GOROOT="/home/mvdan/tip"
GOTMPDIR=""
GOTOOLDIR="/home/mvdan/tip/pkg/tool/linux_amd64"
GCCGO="gccgo"
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-build472648887=/tmp/go-build -gno-record-gcc-switches"
What did you do?
Forget to add an import for an anonymous struct field.
What did you expect to see?
What I see when the field isn't anonymous:
$ cat f.go
package p
type t struct {
F sync.Mutex
}
$ go build f.go
# command-line-arguments
./f.go:4:4: undefined: sync
What did you see instead?
A confusing error about sync
, and a redundant error about Mutex
:
$ cat f.go
package p
type t struct {
sync.Mutex
}
$ go build f.go
# command-line-arguments
./f.go:4:2: sync is not a package
./f.go:4:2: undefined: Mutex
/cc @griesemer
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.