doumu6997 2017-06-16 14:56
浏览 69
已采纳

为什么goapp test在/ tmp中寻找文件?

I'm trying to get tests working on my local dev machine Cloud SDK version is: 159.0.0

Everything I've read says that I should no change GOROOT so I'm not sure how to fix this.

$ /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

Looking at main.go line 155, where I think the error is being thrown, I don't see where "goroot" is being set .

if fi, err := os.Stat(goroot); err != nil || !fi.IsDir() {
    fmt.Fprintf(os.Stderr, "go: cannot find GOROOT directory: %v
", goroot)
    os.Exit(2)
}
  • 写回答

3条回答 默认 最新

  • douchun9719 2017-06-19 18:50
    关注

    You can try and follow the recommendation of this answer:

    If your install is messed up beyond reason (happened to me once), just remove the cloud SDK and any references to it in your $PATH. Also completely uninstall the regular Go installation.

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

    As mentioned in that same answer, you don't set GOROOT anywhere, it is set for you.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 怎么把多于硬盘空间放到根目录下
  • ¥15 Matlab问题解答有两个问题
  • ¥50 Oracle Kubernetes服务器集群主节点无法访问,工作节点可以访问
  • ¥15 LCD12864中文显示
  • ¥15 在使用CH341SER.EXE时不小心把所有驱动文件删除了怎么解决
  • ¥15 gsoap生成onvif框架
  • ¥15 有关sql server business intellige安装,包括SSDT、SSMS。
  • ¥15 stm32的can接口不能收发数据
  • ¥15 目标检测算法移植到arm开发板
  • ¥15 利用JD51设计温度报警系统