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
Assignees
Milestone

Comments

@OneOfOne
Copy link
Contributor

@OneOfOne OneOfOne commented Jun 16, 2020

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
@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Jun 17, 2020

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

@gopherbot
Copy link

@gopherbot gopherbot commented Jun 17, 2020

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.