Skip to content

x/build/version: runtime.GOROOT() returns /usr/local/go instead of ~/sdk/go1.9rc2 #21400

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

Closed
stapelberg opened this issue Aug 11, 2017 · 1 comment
Labels
Builders x/build issues (builders, bots, dashboards) FrozenDueToAge
Milestone

Comments

@stapelberg
Copy link
Contributor

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

go version go1.9rc2 linux/amd64

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

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/michael/go"
GORACE=""
GOROOT="/home/michael/sdk/go1.9rc2"
GOTOOLDIR="/home/michael/sdk/go1.9rc2/pkg/tool/linux_amd64"
GCCGO="/usr/bin/gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build189329817=/tmp/go-build -gno-record-gcc-switches"
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"

What did you do?

% go get -u golang.org/x/build/version/go1.9rc2
% go1.9rc2 download
Downloaded 0.0% (15232 / 98420498 bytes) ...
Downloaded 8.6% (8421376 / 98420498 bytes) ...
Downloaded 22.3% (21953564 / 98420498 bytes) ...
Downloaded 100.0% (98420498 / 98420498 bytes)
Unpacking /home/michael/sdk/go1.9rc2/go1.9rc2.linux-amd64.tar.gz ...
Success. You may now run 'go1.9rc2'
% go1.9rc2 run runtime.go  
2017/08/11 09:04:58 $GOROOT = "/home/michael/sdk/go1.9rc2"
2017/08/11 09:04:58 /home/michael/sdk/go1.9rc2
% go1.9rc2 build runtime.go && ./runtime
2017/08/11 09:05:15 $GOROOT = ""
2017/08/11 09:05:15 /usr/local/go
% cat runtime.go
package main

import (
	"log"
	"os"
	"runtime"
)

func main() {
	log.Printf("$GOROOT = %q\n", os.Getenv("GOROOT"))
	log.Println(runtime.GOROOT())
}

What did you expect to see?

runtime.GOROOT() should always return /home/michael/sdk/go1.9rc2

What did you see instead?

runtime.GOROOT() returned /usr/local/go, which is set in ~/sdk/go1.9rc2/src/runtime/internal/sys/zversion.go

Issue #18136 mentions a build flag (having the tool compile Go on my machine seems like it should fix the issue), but I couldn’t find that — AFAICT, the go1.9rc2 command only supports the “download” flag.

cc @bradfitz

@gopherbot gopherbot added this to the Unreleased milestone Aug 11, 2017
@gopherbot gopherbot added the Builders x/build issues (builders, bots, dashboards) label Aug 11, 2017
@ALTree
Copy link
Member

ALTree commented Aug 11, 2017

Thanks for the report.

This is a duplicate of #21313 (runtime: bad GOROOT in 1.9rc1), so I'm closing this thread in favour of the older one.

@ALTree ALTree closed this as completed Aug 11, 2017
@golang golang locked and limited conversation to collaborators Aug 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Builders x/build issues (builders, bots, dashboards) FrozenDueToAge
Projects
None yet
Development

No branches or pull requests

3 participants