-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
x/tools/cmd/guru: GOROOT needs to be set for guru #22418
Comments
I guess your environment variable And finally, the workaround indicates that Go was perhaps actually installed in Also trying to set GOPATH to point to GOROOT is probably not going to work well. |
@cznic I have made several mistakes in my comment. Sorry for that. I have updated my original comment. |
CC @alandonovan I assume that you built guru yourself, and that it captured the setting of GOROOT used by the tools used to build it. Then you moved your installation, so guru was using the old GOROOT and was not finding anything in the new GOROOT. I have not looked at the code, but perhaps guru should run |
This sounds strongly related to #22303, and affects all static analysis tools. |
@ianlancetaylor yes, sure |
@dominikh - definitely the same problem. @yaojingguo - if you want to avoid setting GOROOT, you can also rebuild the guru with your current set up, which will detect & embed the new (correct) GOROOT. |
@natefinch Thanks. Rebuilding guru works. |
Closing, as setting GOROOT is no longer needed with more recent versions of Go. More context can be found in golang/vscode-go#146, and @hyangah has confirmed that it is no longer necessary to recompile tools when the Go version changes. Furthermore, |
What version of Go are you using (
go version
)?go version go1.9.1 darwin/amd64
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/jing/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/qd/wj_djys9219cyj4l9c2qw6g80000gn/T/go-build712584400=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
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"
Steps to reproduce the problem
I had installed go 1.8.3 in
/usr/local/Cellar/go/1.8.3/libexec
withbrew
before. But I had uninstalled it and installed Go 1.9.1.I checked that
GOROOT
was unset in the terminal withecho $GOROOT
. Then I ranguru definition main.go:#56
. Butguru
saidguru: cannot find package "fmt"
. Here is the terminal session details:Then I ran
export GOROOT=/usr/local/go
in the same terminal. And then runningguru definition main.go:#56
produced:main.go
is on https://play.golang.org/p/eEZMXonMhA.And rogpeppe/godef#73 is a similar problem.
The text was updated successfully, but these errors were encountered: