What version of Go are you using (go version)?
go version go1.16.3 darwin/amd64
Does this issue reproduce with the latest release?
It does not related to the version.
What operating system and processor architecture are you using (go env)?
go env Output
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/furkan.turkal/Library/Caches/go-build"
GOENV="/Users/furkan.turkal/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/furkan.turkal/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/furkan.turkal/go"
GOPRIVATE=""
GOPROXY="direct"
GOROOT="/usr/local/Cellar/go/1.16.3/libexec"
GOSUMDB="off"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.16.3/libexec/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.16.3"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/furkan.turkal/src/public/go/src/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 x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/nq/vxjjn3311fg4q263qsxrghpcpzgp66/T/go-build71174443=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
-
$ git clone https://go.googlesource.com/go
-
$ cd go/src
-
$ ./make.bash # OK
-
Play with the source code (i.e. define a new constant variable, and just use it somewhere)
-
Run the ./make.bash again
What did you expect to see?
It should be built successfully? 🤔
What did you see instead?
- See the error:
Building Go cmd/dist using /usr/local/Cellar/go/1.16.3/libexec. (go1.16.3 darwin/amd64)
Building Go toolchain1 using /usr/local/Cellar/go/1.16.3/libexec.
# bootstrap/go/constant
/Users/furkan.turkal/src/public/go/src/go/constant/value.go:1003: undefined: token.TEST
go tool dist: FAILED: /usr/local/Cellar/go/1.16.3/libexec/bin/go install -gcflags=-l -tags=math_big_pure_go compiler_bootstrap bootstrap/cmd/...: exit status 2
undefined: token.TEST: But it's already defined in the cloned repo. Bootstrap throws this error because it was not defined in /usr/local/Cellar/go/1.16.3/libexec/src/go/token/token.go file, and $GOROOT_BOOTSTRAP lookup that directory.
But I could not figure out how to make the GOROOT_BOOTSTRAP env to look at the source directory when compiling. It uses my /usr/local path which I've installed with Brew.
If I run the following command in ./src:
$ GOROOT_BOOTSTRAP="/Users/furkan.turkal/src/public/go" ./make.bash
It's failing:
Building Go cmd/dist using /Users/furkan.turkal/src/public/go. (devel go1.17-fe26dfadc3 Tue Apr 20 02:42:23 2021 +0000 darwin/amd64)
ERROR: $GOROOT_BOOTSTRAP must not be set to $GOROOT
Set $GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4.
I have followed the exact same steps when I was working with Go 1.16. Is this because Go 1.17 has some kind of behavioral change? Or am I missing something important here?
What version of Go are you using (
go version)?Does this issue reproduce with the latest release?
It does not related to the version.
What operating system and processor architecture are you using (
go env)?go envOutputWhat did you do?
$ git clone https://go.googlesource.com/go$ cd go/src$ ./make.bash # OKPlay with the source code (i.e. define a new constant variable, and just use it somewhere)
Run the
./make.bashagainWhat did you expect to see?
It should be built successfully? 🤔
What did you see instead?
undefined: token.TEST: But it's already defined in the cloned repo. Bootstrap throws this error because it was not defined in/usr/local/Cellar/go/1.16.3/libexec/src/go/token/token.gofile, and$GOROOT_BOOTSTRAPlookup that directory.But I could not figure out how to make the
GOROOT_BOOTSTRAPenv to look at the source directory when compiling. It uses my/usr/localpath which I've installed with Brew.If I run the following command in
./src:$ GOROOT_BOOTSTRAP="/Users/furkan.turkal/src/public/go" ./make.bashIt's failing:
I have followed the exact same steps when I was working with Go 1.16. Is this because Go 1.17 has some kind of behavioral change? Or am I missing something important here?