Go
Go module workspace support and git-tag publishing.
The Go plugin discovers modules from go.work or a root go.mod, bumps versions, updates require directives, and publishes via git tags.
import { tegami } from "tegami";
import { go } from "tegami/plugins/go";
const paper = tegami({
plugins: [go()],
});Requirements
Go modules publish through git tags. When Go modules are present, the Go plugin requires either Git, GitHub, or GitLab plugin to be configured.
How Go versioning works
Go modules do not store a version in go.mod. Tegami tracks versions differently from npm or Cargo:
- Current version is read from existing git tags (
v1.0.0for the root module,pkg/api/v1.0.0for nested modules). - Next version is written to the publish lock during
tegami version, not togo.mod. - Publishing creates git tags that the Go proxy picks up. Tegami delegates tagging to the git plugin.
Discovery
Tegami discovers modules with the go CLI:
- If
go.workexists, every entry inuseis scanned. - Otherwise, the root
go.modis treated as a single-module workspace.
Each module's require and replace directives are read from go mod edit -json.
Dependency bumping
When a module is bumped, dependents with a require on that module are patch-bumped by default. Tegami also rewrites require directives when the new version falls outside the existing constraint.
| Situation | Default dependent bump |
|---|---|
require on a workspace module | patch |
Members of the same package group with syncBump are not auto-bumped when a sibling is released.
Customize this with bumpDep:
go({
bumpDep: () => "minor",
});Configuration
const paper = tegami({
plugins: [
go({
updateLockFile: false,
}),
],
});Prop
Type
After versioning, Tegami runs go work sync when a go.work file is present, or go mod tidy in each module otherwise.
Publishing
Publishing is handled through git tags, not a registry upload. Tegami:
- Sets the tag for each module (
v1.2.0at the repo root,relative/path/v1.2.0for nested modules). - Waits for workspace dependencies (from
requireand localreplacedirectives) before publishing a module. - Waits for the git plugin to create (and push) the tags, a module publish fails when its tag work fails.
- Checks proxy.golang.org to see whether a version is already available.
Package options
Disable publishing for specific modules with packages or groups:
tegami({
plugins: [git(), go()],
groups: {
internal: {
go: { publish: false },
},
},
packages: {
"example.com/acme/api": {
go: { publish: true },
},
},
});Package-level go.publish overrides the group default.