- Documentation
- Technologies
- Go
Go
Guara Cloud fully supports Go applications. Go’s compiled nature makes it ideal for containerized deployments — producing small, fast, self-contained binaries.
Supported versions
The following Go versions are auto-detected:
- Go 1.21
- Go 1.22
- Go 1.23
The version is auto-detected from the go directive in your go.mod file.
// go.mod
module my-app
go 1.23
Deploy with Dockerfile
A multi-stage build is the recommended approach for Go applications. It compiles your binary in a full Go environment, then copies only the binary into a minimal runtime image.
Deploy with Buildpack
If your repository does not contain a Dockerfile, Guara Cloud automatically detects your Go project by the presence of a go.mod or go.work file.
The auto-detection will:
- Detect the Go version from
go.mod - Download dependencies with
go mod download - Build your application (Go workspaces via
go.workare supported) - Run the compiled binary directly
CGO support is available when your application requires C dependencies.
Port configuration
Your application must listen on the port configured in your service settings. The default is 3000, but you can change it at any time to match your application.
port := os.Getenv("PORT")
if port == "" {
port = "3000"
}
http.ListenAndServe(":"+port, nil)
Example project structure
my-go-app/
go.mod
go.sum
main.go
internal/
handlers/
models/
Dockerfile # optional — omit to use Buildpack
Environment variables
These environment variables are commonly used with Go deployments:
| Variable | Recommended value | Description |
|---|---|---|
PORT | Set by platform | The port your application must listen on |
CGO_ENABLED | 0 | Produces a statically linked binary (no C deps) |
GOOS | linux | Target operating system for cross-compilation |