Specifying Dependencies

You can use any linux/amd64-compatible package in the App Engine standard environment. These instructions assume you are using the go get command to get the packages directly from supported repositories, such as GitHub, Bitbucket, LaunchPad, etc.

Declaring and managing dependencies

When deploying your app to App Engine, the Go 1.11 runtime automatically installs all dependencies by taking one of the following approaches:

  • If your application is in a directory on your GOPATH, App Engine analyzes, copies, and uploads your imports from GOPATH. This approach supports vendor directories.
  • If you use Go Modules through a go.mod file, App Engine uploads only your application files and automatically fetches those dependencies.

All imports must be absolute imports. For example, use:

import "github.com/example/mypackage"

Downloading required packages

Use the go get command to download dependencies.

For example, to depend on the https://github.com/gorilla/mux URL router:

  1. Download the package to your development environment using the following command:

    go get github.com/gorilla/mux
  2. Add the package to your list of imports:

    import "github.com/gorilla/mux"
Оцените, насколько информация на этой странице была вам полезна:

Оставить отзыв о...

Текущей странице
App Engine standard environment for Go 1.11 docs