Skip to main content

Go SDK

RBS provides hermetic Go support with automatic Go SDK management, hermetic builds with GOPROXY=off, and cross-compilation via platform flags.

Setup

Toolchain

Register a Go toolchain in WORKSPACE.rbs:
RBS downloads the Go SDK for your platform and uses it for all Go builds.

Rules

go_library

Creates a reusable Go library (source packaging for dependents).

go_binary

Creates an executable Go binary.

go_test

Runs Go tests.

Hermetic Builds

By default, RBS runs Go builds with GOPROXY=off and GOSUMDB=off, ensuring the Go tool cannot fetch modules from the network at build time. All dependencies must be vendored or pre-fetched. For stdlib-only builds (no go.mod), RBS automatically sets GO111MODULE=off so go build works without a module root.

Cross-Compilation

Use the RBS_TARGET_PLATFORM environment variable to cross-compile:

Example