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

cmd/go2go: fails to build the testdata #39617

Closed
OneOfOne opened this issue Jun 16, 2020 · 2 comments
Closed

cmd/go2go: fails to build the testdata #39617

OneOfOne opened this issue Jun 16, 2020 · 2 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@OneOfOne
Copy link
Contributor

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

$ go version
go version devel +ad307489d4 2020-06-16 05:49:35 +0000 linux/amd64

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN="/home/oneofone/code/go/bin"
GOCACHE="/home/oneofone/.cache/go-build"
GOENV="/home/oneofone/.config/go/env"
GOEXE=""
GOFLAGS="-gcflags=-c=16"
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/usr/src/go2/src/cmd/go2go/testdata/go2path/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/usr/src/go2/src/cmd/go2go/testdata/go2path"
GOPRIVATE=""
GOPROXY="direct"
GOROOT="/usr/src/go2"
GOSUMDB="off"
GOTMPDIR=""
GOTOOLDIR="/usr/src/go2/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/usr/src/go2/src/cmd/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-build427285826=/tmp/go-build -gno-record-gcc-switches"

What did you do?

$ export GOPATH=/usr/src/go2/src/cmd/go2go/testdata/go2path
$ cd $GOPATH/src/slices
$ go2 tool go2go test
type checking failed for slices
slices.go2:10:2: could not import alg (type checking failed for alg
/tmp/go2go918845650/src/alg/alg.go2:8:8: could not import constraints (open /usr/src/go2/src/cmd/vendor/constraints: no such file or directory)
/tmp/go2go918845650/src/alg/alg.go2:12:5: cannot compare a < b (operator < not defined for T)
/tmp/go2go918845650/src/alg/alg.go2:20:5: cannot compare a < b (operator < not defined for T)
)

and without explicit GOPATH:

type checking failed for slices
slices.go2:10:2: could not import alg (cannot find package "alg" in any of:
/usr/src/go2/src/alg (from $GOROOT)
/home/oneofone/go/src/alg (from $GOPATH))
slices.go2:11:2: could not import constraints (cannot find package "constraints" in any of:
/usr/src/go2/src/constraints (from $GOROOT)
/home/oneofone/go/src/constraints (from $GOPATH))
slices_test.go2:46:18: cannot convert 1 (untyped int constant) to Elem
slices_test.go2:46:32: cannot convert 1 (untyped int constant) to Elem
@griesemer griesemer added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jun 17, 2020
@griesemer griesemer added this to the Unreleased milestone Jun 17, 2020
@ianlancetaylor
Copy link
Contributor

You need to set GO2PATH, not GOPATH, to find .go2 packages. Closing, but please comment if it still doesn't work.

@gopherbot
Copy link

Change https://golang.org/cl/238498 mentions this issue: README.go2go: add a note about GO2PATH

gopherbot pushed a commit that referenced this issue Jun 17, 2020
Adds a little note about `GO2PATH` and that it is required for the `go2go` tool.

Updates #39617

Change-Id: I9e3cea16a7d7539555180dc065957d6a56f390b9
GitHub-Last-Rev: 2aa6815
GitHub-Pull-Request: #39657
Reviewed-on: https://go-review.googlesource.com/c/go/+/238498
Reviewed-by: Ian Lance Taylor <iant@golang.org>
@golang golang locked and limited conversation to collaborators Jun 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants