Why is the goapp test looking for files in / tmp?

I am trying to get tests running on my local machine for developers. Cloud SDK Version: 159.0.0

All I read says that I should not change GOROOT, so I'm not sure how to fix it.

$ / Users / bryan / google-cloud-sdk / platform / google_appengine / goroot / bin / goapp test

go: cannot find GOROOT directory: /tmp/go_sdk887571938/appengine/go_appengine/goroot 

Bryan @ Bryans-MacBook Thu Jun 15 10:22:37 ~ / go / src / skincarereview

$ go env

 GOARCH="amd64" GOBIN="" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOOS="darwin" GOPATH="/Users/bryan/go/" GORACE="" GOROOT="/usr/local/go" GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64" GO15VENDOREXPERIMENT="1" CC="clang" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common" CXX="clang++" CGO_ENABLED="1" 

Bryan @ Bryans-MacBook Thu Jun 15 10:22:57 ~ / go / src / skincarereview

$ ls ~ / google-cloud-sdk

 total 408 drwxr-xr-x 30 bryan staff 1020 Jun 14 20:31 .install -rw-r--r-- 1 bryan staff 980 Jun 14 20:30 LICENSE -rw-r--r-- 1 bryan staff 673 Jun 14 20:30 README -rw-r--r-- 1 bryan staff 162673 Jun 14 20:30 RELEASE_NOTES -rw-r--r-- 1 bryan staff 8 Jun 14 20:30 VERSION drwxr-xr-x 10 bryan staff 340 Jun 14 20:30 bin -rw-r--r-- 1 bryan staff 2734 Jun 14 20:30 completion.bash.inc -rw-r--r-- 1 bryan staff 2083 Jun 14 20:30 completion.zsh.inc drwxr-xr-x 3 bryan staff 102 Jun 14 20:30 help -rwxr-xr-x 1 bryan staff 1581 Jun 14 20:30 install.bat -rwxr-xr-x 1 bryan staff 3471 Jun 14 20:30 install.sh drwxr-xr-x 10 bryan staff 340 Jun 14 20:30 lib -rw-r--r-- 1 bryan staff 308 Jun 14 20:30 path.bash.inc -rw-r--r-- 1 bryan staff 1210 Jun 14 20:30 path.fish.inc -rw-r--r-- 1 bryan staff 31 Jun 14 20:30 path.zsh.inc drwxr-xr-x 6 bryan staff 204 Jun 14 20:30 platform -rw-r--r-- 1 bryan staff 40 Jun 14 20:30 properties 

bryan @ Bryans-MacBook Thu Jun 15 10:24:22 ~ / go / src / skincarereview

$ find / -name goroot 2> / dev / null

 /Users/bryan/google-cloud-sdk/platform/google_appengine/goroot 

Bryan @ Bryans-MacBook Thu Jun 15 10:28:43 ~ / go / src / skincarereview

$ echo $ PATH

 /Users/bryan/google-cloud-sdk/bin:/Users/bryan/go/src/:/Users/bryan/google-cloud-sdk/platform/google_appengine/goroot/bin/:/Users/bryan/google-cloud-sdk/bin/:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin 

Having looked at the line main.go 155, where, it seems to me, an error occurs, I don’t see where "goroot" is installed.

 if fi, err := os.Stat(goroot); err != nil || !fi.IsDir() { fmt.Fprintf(os.Stderr, "go: cannot find GOROOT directory: %v\n", goroot) os.Exit(2) } 
+7
google-app-engine go
source share
3 answers

You can try and follow the recommendation of this answer :

If your installation is confused no difference (with me once), just remove the cloud SDK and any links to it in $PATH . Also completely uninstall the normal Go installation.

Then start from scratch. Install Go, unzip google-cloud-sdk , run the installer (if necessary add to $PATH ), gcloud components install app-engine-go .
Voila.

As mentioned in the same answer, you do not install GOROOT anywhere, it is installed for you .

+1
source share

You might want to read how run / test works. The program is mainly embedded in a temporary place and then launched, so there may be a reason why it complains about your goroot.

This question may help you: Golang: tests and working directory

+1
source share

I believe that you are causing the wrong goapp. You should call the one that is directly in the google_appengine folder as follows:

 /Users/bryan/google-cloud-sdk/platform/google_appengine/goapp test 

If you do not have goapp in google_appengine for some reason, I will be very surprised, but the following should work. (However, this is the correct way to call it. Goapp resolves the appengine goroot as a relative path from its own location, so it is important where the goapp itself is located.)

 GOROOT=/Users/bryan/google-cloud-sdk/platform/google_appengine/goroot /Users/bryan/google-cloud-sdk/platform/google_appengine/goapp test 
0
source share

All Articles