Where does GO look for google-cloud-sdk?
GO does not look for the google-cloud-sdk in either $GOROOT or $GOPATH. To set up the google-cloud-sdk, simply unpack it to your $HOME directory and run the installer.
What should GOPATH be?
Your $GOPATH should be set to your normal installation. The App Engine SDK for Go automatically uses the sources in the google-cloud-sdk/platform/google_appengine/goroot/src directory without any manipulation.
Additional Tips:
Do not manually change $GOROOT unless you are planning on compiling a new Go version from source. If your installation is messed up beyond repair, remove the cloud SDK and any references to it in your $PATH. Also, completely uninstall the regular Go installation. Then start from scratch by installing Go, unpacking google-cloud-sdk, running the installer, and gcloud components installing app-engine-go.
When developing for App Engine, your Go sources should go into your regular $GOPATH, not in the google-cloud-sdk/ directory. To run the dev_appserver locally, run dev_appserver.py [path-to-source], where the given path contains your code and the app.yaml.
Edited Folder Structure:
$GOPATH = $HOME/go
[Image of the edited folder structure]
Location for google-cloud-sdk folder:
[Image of the location for google-cloud-sdk folder]
The above is the detailed content of Where Does Go Find the google-cloud-sdk and How Should GOPATH Be Set?. For more information, please follow other related articles on the PHP Chinese website!