Determining the Location for google-cloud-sdk
For Google App Engine Go, the google-cloud-sdk package should not be placed in either $GOROOT or $GOPATH. Instead, it should be unpacked to your $HOME directory and the installer executed.
Setting $PATH for google-cloud-sdk
If necessary, add the following line to your .bash_profile to include google-cloud-sdk in your $PATH:
export PATH=$HOME/google-cloud-sdk:$PATH
Getting the Go SDK for App Engine
Install the Go SDK for App Engine with the following command:
gcloud components install app-engine-go
Pitfalls to Avoid
Never modify $GOROOT manually unless you are compiling a new Go version from source. Also, avoid changing your $GOPATH to include the src dir in google-cloud-sdk/platform/google_appengine/goroot/src, as this will cause issues.
Go Source Location
Go sources for App Engine projects should be placed in your regular GOPATH. These sources go into your project path, not into any google-cloud-sdk directory.
Running the Development Server
To run the dev_appserver locally, navigate to your project path and use the following command:
dev_appserver.py ./.
Deployment
For information on deployment, refer to this documentation: https://cloud.google.com/appengine/docs/standard/go/tools/uploadinganapp
Tips for Troubleshooting
If your installation encounters any problems, consider removing the cloud SDK and any references to it in your $PATH. Uninstall the regular Go installation as well. Then, start from scratch by installing Go, unpacking google-cloud-sdk, and running the installer.
The above is the detailed content of Where Should I Install the Google Cloud SDK for Google App Engine Go?. For more information, please follow other related articles on the PHP Chinese website!