Go Modules And Versioning

Guides Go module mechanics and versioning — author and edit go.mod/go.sum through the go command (never by hand), understand that MVS selects the minimum version that satisfies all requirements (not the latest), put /v2 in both the module path and the import path for v2+ (semantic import versioning), keep go.sum committed, run go mod tidy before committing, treat the go directive as a gate on language features and the toolchain line as a request, use replace/exclude/retract correctly, declare build tools with tool directives (1.24) instead of the tools.go hack, and develop multiple local modules together with go.work workspaces. Auto-invokes when writing or editing go.mod/go.sum, adding dependencies, running go get / go mod tidy, doing a major-version /v2 import, using replace/retract/tool directives or go.work, or on "how do I add this dependency" / "why won't this v2 import resolve" requests. The module-lifecycle depth behind the policy root's "work with the toolchain, don't fight it."

ctoth 2ccb2df 3 files · 29.1 KB Updated

File contents

ctoth/golang-skills-plugin/tree/main/plugins/golang/skills/go-modules-and-versioning commit 2ccb2dfae0

Frequently asked questions

npx skillmds@latest add ctoth/go-modules-and-versioning