Go workspace

A go.work file that tells the go command to build several local modules together from your disk instead of from their published versions.

In more detail

It solves the tool-plus-library problem: edit a library and the tool that imports it sees the change at once, with no publishing or version bump. It replaces the older habit of adding a temporary replace directive. The file describes your machine, so keep it out of the repository, and set GOWORK=off to check the module builds as a stranger would.

Examples

go work init ./tool ./lib
GOWORK=off go build ./...

Related terms

Taught in

References