Skip to content

Go

Curated name go. Installs the Go toolchain via the upstream devcontainers/features/go feature, including golangci-lint.

Terminal window
monoceros init acme --with-languages=go
monoceros add-language acme go:1.24
Terminal window
monoceros remove-language acme go

Or delete the entry from acme.yml by hand and re-run monoceros apply acme - the yml is the source of truth.

Terminal window
monoceros add-language acme go:1.24

Supported: 1.24, 1.23 (also latest).

A Go build is only slow once. The build cache and the module cache live in a volume shared by every workbench on the machine, so a dependency is downloaded and compiled one time and then reused - by the next build, by the next workbench, and after a monoceros apply recreates the container. On a mid-sized project that is well over two gigabytes you do not pay for twice.

The tools a project installs itself stay per workbench:

Terminal window
go install golang.org/x/vuln/cmd/govulncheck@v1.3.0

That lands in ~/go/bin, which is bound to your workbench directory and survives a rebuild, so a make dev-tools-style setup step is a one-time thing rather than something you repeat after every apply. Per workbench on purpose: two projects can pin different versions of the same linter, and one shared directory would only hold one of them. ~/go/bin also comes first on PATH, ahead of the tools the upstream feature ships in /go/bin, so your pinned version is the one that runs.

This needs runtime 1.6.2 or newer. Run monoceros upgrade to move an older workbench up.

Set these by adding the feature directly (see Other feature options):

OptionDefaultNotes
versionlatestPin via the :version suffix instead.
golangciLintVersionlatestPin the linter version.

Full option list: upstream feature.