When I try to update my appengine project, it gives me an error.
$ sudo gcloud app deploy
ERROR: (gcloud.app.deploy) Staging command [/usr/local/google-cloud-sdk/platform/google_appengine/goroot-1.6/bin/go-app-stager /Users/baz/app/app.yaml /tmp/tmpSZLK/tmpIQ4] failed with return code [1].
------------------------------------ STDOUT ------------------------------------
------------------------------------ STDERR ------------------------------------
2017/07/08 16:22:06 failed analyzing /Users/baz/app: cannot find package "bitbucket.org/foo/bar" in any of:
($GOROOT not set)
($GOPATH not set)
GOPATH:
$ echo $GOPATH
/Users/baz/go
$ go env GOPATH
/Users/baz/go
Clearly GOPATH is set (I export it in my .bash_profile).
TL;DR - Do not use sudo
for deploying the app.
You're running the gcloud app deploy
command using sudo
. sudo
by the nature of the command will not retain the current set of environment variables when running the command as root
user.
Try deploying your app engine app without sudo
:
gcloud app deploy
If you do need to run you command as sudo
(which is a smell that your setup is broken somehow), you can look at this post. Although, I would recommend looking into the possibility of running your command without sudo
.