← All notes

Go multi-module workspaces (go.work)

Answer: A go.work file lists the module directories; commands in the workspace treat those modules as main modules, so local changes in one are used by the others.

Create one

mkdir ws && cd ws
go work init ./hello
go work use ./example/hello

Resulting go.work:

go 1.22
use (
    ./hello
    ./example/hello
)

Tips

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted).

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: The Go Authors (go.dev), Tutorial: Getting started with multi-module workspaces - The Go Programming Language, CC BY 4.0 (go.dev text); The Go Authors (go.dev), Go Modules Reference - The Go Programming Language, CC BY 4.0 (go.dev text).

Cite this

Permanent ID: iil:note:j5tjakcv

iinventedlight. 2026. "Go multi-module workspaces (go.work)." iinventedlight Library, iil:note:j5tjakcv, version of 2026-11-04. https://iinventedlight.com/library/notes/go-workspaces/. License: CC-BY-4.0.

@misc{iil_note_j5tjakcv,
  author = {{iinventedlight}},
  title = {{Go multi-module workspaces (go.work)}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-04},
  url = {https://iinventedlight.com/library/notes/go-workspaces/},
  note = {Permanent ID iil:note:j5tjakcv. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.

For language models and agents: start at /llms.txt. This page in Markdown: /library/notes/go-workspaces.md.