Go: x/tools: undefined error running go get golang.org/x/tools

Created on 13 Jun 2018  ·  10Comments  ·  Source: golang/go

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

go version go1.10.3 linux/amd64

Does this issue reproduce with the latest release?

Yes

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

docker run golang:1.10.3 sh -c "go env "
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/go"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
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-build620362171=/tmp/go-build -gno-record-gcc-switches"

What did you do?

docker run golang:1.10.3 sh -c "go get -u golang.org/x/tools/..."
# golang.org/x/tools/go/internal/gccgoimporter
src/golang.org/x/tools/go/internal/gccgoimporter/parser.go:605:9: undefined: types.NewInterface2
# golang.org/x/tools/go/internal/gcimporter
src/golang.org/x/tools/go/internal/gcimporter/bimport.go:541:8: undefined: types.NewInterface2
src/golang.org/x/tools/go/internal/gcimporter/iimport.go:540:10: undefined: types.NewInterface2
docker run golang:1.10.3 sh -c "go get -u golang.org/x/tools/..."
# golang.org/x/tools/go/internal/gccgoimporter
src/golang.org/x/tools/go/internal/gccgoimporter/parser.go:605:9: undefined: types.NewInterface2
# golang.org/x/tools/go/internal/gcimporter
src/golang.org/x/tools/go/internal/gcimporter/bimport.go:541:8: undefined: types.NewInterface2
src/golang.org/x/tools/go/internal/gcimporter/iimport.go:540:10: undefined: types.NewInterface2

What did you expect to see?

Successful go get execution

What did you see instead?

# golang.org/x/tools/go/internal/gccgoimporter
src/golang.org/x/tools/go/internal/gccgoimporter/parser.go:605:9: undefined: types.NewInterface2
# golang.org/x/tools/go/internal/gcimporter
src/golang.org/x/tools/go/internal/gcimporter/bimport.go:541:8: undefined: types.NewInterface2
src/golang.org/x/tools/go/internal/gcimporter/iimport.go:540:10: undefined: types.NewInterface2
FrozenDueToAge NeedsFix Soon

Most helpful comment

Given that a number of us are coming across the same problem, let's be nice to the maintainers and not post confirmations unless we have constructive info that'll help them put out the fire 😄. Also, it's great to see so many of us are using golint!

All 10 comments

Our automated build system is now also breaking on import

+ go get -u github.com/golang/lint/golint
# golang.org/x/tools/go/internal/gcimporter
src/golang.org/x/tools/go/internal/gcimporter/bimport.go:541:8: undefined: types.NewInterface2
src/golang.org/x/tools/go/internal/gcimporter/iimport.go:540:10: undefined: types.NewInterface2

Confirmed. /cc @griesemer.

I'm also getting a failure on this

$ go get github.com/golang/lint/golint
# golang.org/x/tools/go/internal/gcimporter
../../../golang.org/x/tools/go/internal/gcimporter/bimport.go:541:8: undefined: types.NewInterface2
../../../golang.org/x/tools/go/internal/gcimporter/iimport.go:540:10: undefined: types.NewInterface2

Given that a number of us are coming across the same problem, let's be nice to the maintainers and not post confirmations unless we have constructive info that'll help them put out the fire 😄. Also, it's great to see so many of us are using golint!

Same issue here. Any ETA on the fix?

00:01:41.677 # golang.org/x/tools/go/internal/gcimporter
00:01:41.677 /opt/gotools/obj/src/golang.org/x/tools/go/internal/gcimporter/bimport.go:541:8: undefined: types.NewInterface2
00:01:41.677 /opt/gotools/obj/src/golang.org/x/tools/go/internal/gcimporter/iimport.go:540:10: undefined: types.NewInterface2
00:01:41.729 gotools.mk:53: recipe for target 'gotool.golint' failed

working on it

All: Apologies for all this.

Post-mortem: Late last night (with emphasis on "late") I created a larger CL in an attempt to finally update x/tools with all the latest fixes and changes that we've made to the various importers in the std lib. This also included fixes to go/types and new tests. The CL was approved and passed all (1.11) tests and I submitted it somewhat in a rush this morning while running out of the door, not thinking abut pre-1.11 builds. As we all saw, the non-1.11 builds failed quickly, and with it tools such as lint that depend on go/types. It was "obvious" what needed to be fixed (the go/types.NewInterface2 call is missing pre-1.11). While submitting that fix, I missed a couple of places (sigh), and also the fact that Interface.EmbeddedType was new as well. Finally, some of the new tests don't pass at all pre-1.11 due to larger fixes in go/types. I've split up the code into version-tagged files and I believe it works now. The primary reason for having these problems in the first place (and not fixing it all with a single CL) is that I relied on the builders to test non-1.11 versions for "expediency" (I hoped to get around installing a pre-1.11 setup on my new laptop while on the go.) Lesson (re-)learned.

I still see a build failure for 1.9 but it is unrelated to the importers.

Please confirm this is now working again and close if so. Thanks.

golang/lint#402 has been confirmed as fixed; this is the same issue. Closing.

Was this page helpful?
0 / 5 - 0 ratings