The Google Cloud CLI
is a set of tools for Google Cloud. It contains the
gcloud
and bq
command-line tools used to access Compute Engine, Cloud Storage,
BigQuery, and other services from the command line. You can run these
tools interactively or in your automated scripts.
For example, to deploy a Go web app with a main
package to App Engine, run the following command:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eInstall the Go programming language by following the instructions in the Go Getting Started guide to prepare for development.\u003c/p\u003e\n"],["\u003cp\u003eEnhance Go development efficiency by installing editor plugins or IDEs that offer debugging, syntax highlighting, and code completion.\u003c/p\u003e\n"],["\u003cp\u003eUtilize the Google Cloud CLI, which includes the \u003ccode\u003egcloud\u003c/code\u003e and \u003ccode\u003ebq\u003c/code\u003e command-line tools, to interact with Google Cloud services like Compute Engine and BigQuery.\u003c/p\u003e\n"],["\u003cp\u003eIntegrate Google Cloud services into your Go projects using the Cloud Client Libraries for Go, installing them via the \u003ccode\u003ego get\u003c/code\u003e command, for example \u003ccode\u003ego get cloud.google.com/go/storage\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eSet up Application Default Credentials for local development by using the \u003ccode\u003egcloud auth application-default login\u003c/code\u003e command, enabling the use of Cloud Client Libraries.\u003c/p\u003e\n"]]],[],null,["# Setting up your development environment\n\nPrepare your environment for\n[Go](https://golang.org/)\napp development and deployment on Google Cloud by installing\nthe following tools.\n\nInstall Go\n----------\n\n1. To install Go, see [Go Getting Started](https://golang.org/doc/install).\n\n2. Confirm that you have the most recent version of Go installed:\n\n go version\n\nInstall an editor\n-----------------\n\nTo maximize your Go development efficacy, these\n[popular editor plugins and IDEs](https://golang.org/doc/editors.html)\nprovide the following features:\n\n- Fully integrated debugging capabilities\n- Syntax highlighting\n- Code completion\n\nInstall the Google Cloud CLI\n----------------------------\n\nThe [Google Cloud CLI](/sdk)\nis a set of tools for Google Cloud. It contains the\n[`gcloud`](/sdk/gcloud)\nand [`bq`](/bigquery/docs/bq-command-line-tool)\ncommand-line tools used to access Compute Engine, Cloud Storage,\nBigQuery, and other services from the command line. You can run these\ntools interactively or in your automated scripts.\n\nFor example, to [deploy a Go web app](/appengine/docs/standard/go/create-app) with a `main`\npackage to App Engine, run the following command: \n\n gcloud app deploy\n\nTo install the gcloud CLI, see [Installing the gcloud CLI](/sdk/install).\n\nInstall the Cloud Client Libraries for Go\n-----------------------------------------\n\nThe [Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go)\nis the idiomatic way for Go developers to integrate with\nGoogle Cloud services, such as Datastore and Cloud Storage.\n\nFor example, to install the package for an individual API, such as the Cloud Storage API,\ndo the following:\n\n1. If you already have a Go module for your project, change to that directory.\n Otherwise, create a module:\n\n ```\n go mod init YOUR_MODULE_NAME\n ```\n\n \u003cbr /\u003e\n\n Replace \u003cvar translate=\"no\"\u003eYOUR_MODULE_NAME\u003c/var\u003e with the name of the new module.\n2. Use the Cloud Storage package in your project:\n\n ```\n go get cloud.google.com/go/storage\n ```\n\n \u003cbr /\u003e\n\n | **Note:** The source of the Cloud Client Libraries for Go is [on GitHub](https://github.com/googleapis/google-cloud-go)\n\nSet up authentication\n---------------------\n\nTo use the Cloud Client Libraries in a local development environment, set\nup Application Default Credentials.\n\n\nIf you're using a local shell, then create local authentication credentials for your user\naccount:\n\n```bash\ngcloud auth application-default login\n```\n\nYou don't need to do this if you're using Cloud Shell.\n\n\nIf an authentication error is returned, and you are using an external identity provider\n(IdP), confirm that you have\n[signed in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n\nFor more information, see\n[Authenticate for using client libraries](/docs/authentication/client-libraries).\n\nInstall other useful tools\n--------------------------\n\nFor a comprehensive list of Go tools and libraries, see\n[this list of Go frameworks, libraries, and software on GitHub](https://github.com/avelino/awesome-go).\n\nWhat's next\n-----------\n\n- Learn more about [Go on Google Cloud](/go).\n- Deploy a Go app on [App Engine](/appengine/docs/standard/go/create-app).\n- Explore [authentication methods at Google](/docs/authentication).\n- Browse the [documentation for Google Cloud products](/products).\n- Clone the [Go samples repository from GitHub](https://github.com/GoogleCloudPlatform/golang-samples)."]]