Supported versions
You can select the major and minor version. Patch versions are applied periodically for bug fixes and the like. When you deploy your app, you always get the latest available patches.Specify the language
To use Go, specifygolang as your app’s type:
For example:
Go toolchain auto download
Even though you select a specific version of Go, starting in Go 1.21, thego command will automatically download and use a different toolchain version as requested by the toolchain directive in go.mod, or the GOTOOLCHAIN environmental variable (see Go Toolchains).
Still, it is important to keep your chosen version of Go updated in your yaml configuration file. This will ensure that you are using the most up to date software for your projects.
Go modules
The recommended way to handle Go dependencies on Upsun is using Go module support in Go 1.11 and later. That allows the build process to usego build directly without any extra steps, and you can specify an output executable file of your choice. (See the examples below.)
Building and running the application
Assuming yourgo.mod and go.sum files are present in your repository, your application can be built with the command go build, to produce a working executable. You can then start it from the web.commands.start directive. Note that the start command must run in the foreground. If the program terminates for any reason it is automatically restarted.
The following basic .upsun/config.yaml file is sufficient to run most Go applications.
Note that there is still an Nginx proxy server sitting in front of your application.
If desired, certain paths may be served directly by Nginx without hitting your application (for static files, primarily)
or you may route all requests to the Go application unconditionally, as in the example above.