Skip to content

Go

Version: 1.0.0 | Tests: Passing

devcontainer.json
{
    "features": {
        "ghcr.io/infrashift/trusted-devcontainer-features/golang:latest": {
            "target_version": "1.26.0",
            "target_checksum": "aac1b08a0fb0c4e0a7c1555beb7b59180b05dfc5a3d62e40e9de90cd42f88235"
        }
    }
}
OptionTypeDefaultDescription
target_versionstring1.26.0Select a supported Golang binary version
target_checksumstringaac1b08a0fb0c4e0a7c1555beb7b59180b05dfc5a3d62e40e9de90cd42f88235Select the corresponding Golang binary checksum

None — this feature is independent and has no dependencies.

This feature downloads the official Go binary distribution from go.dev as a tarball (go<version>.linux-amd64.tar.gz) and installs it into a user-local directory. Go is a statically typed, compiled language designed for simplicity and performance, widely used for cloud infrastructure tooling, container runtimes, and CLI applications.

The Ansible playbook creates ~/.local/share/go as the Go installation root, downloads the tarball for the specified version, and verifies the SHA256 checksum to ensure the download has not been tampered with. A default checksum is provided for the bundled version, but you can override it when pinning to a different version. After verification, the tarball is extracted into the installation directory.

The playbook configures GOPATH at ~/.local/share/gopath, which is where Go modules, build caches, and installed binaries are stored. Both the Go binary directory (~/.local/share/go/bin) and the GOPATH bin directory (~/.local/share/gopath/bin) are added to PATH, so the go command and any binaries installed via go install are immediately available. The VS Code Go extension is recommended for full language support including IntelliSense, debugging, and test integration.