Go Runtime Environment
This article serves as a thorough introduction to Cloud Engine’s Go runtime environment. To quickly get started with Cloud Engine, see Getting Started With Cloud Engine.
At this time, Cloud Engine can only manage dependencies with Go Modules.
A Go project has to have a go.mod under its root directory for Cloud Engine to correctly identify it as a Go project.
Commands for Building and Running
By default, Cloud Engine builds your project with go build -o main and runs the compiled executable (main). You can customize the commands for building and running your project with leanengine.yaml:
build: go build -o myapp
run: ./myapp
Configure Go Version
Cloud Engine will use the Go version specified in go.mod:
go 1.14
If you don’t specify a Go version, the latest stable version will be used.
Install Dependencies (go.mod)
Cloud Engine will automatically install the dependencies listed in go.mod and go.sum.
Customize Build Process
You can override the default behavior by specifying startup commands (run), dependency installation commands (install), and build commands (build) in leanengine.yaml:
run: echo 'run another command'
install:
- {use: 'default'}
- echo 'install additional dependencies here'
build:
- echo 'overwrite default build command here'
See Reference: leanengine.yaml for more information.
System Dependencies
You can specify the system dependencies provided by the server-side environment using leanengine.yaml:
systemDependencies:
- imagemagick
See Reference: leanengine.yaml for a complete list of supported system dependencies.