Skip to content

Migrate Go tools to modules; add Go build/vet/test CI - #8

Merged
mholloway24 merged 1 commit into
masterfrom
mh/go-modules
Jul 13, 2026
Merged

mholloway24 merged 1 commit into
masterfrom
mh/go-modules

Conversation

@mholloway24

Copy link
Copy Markdown

Summary

Migrates the three Go tools from dep (Gopkg.toml/lock) to Go modules so go build/go vet/go test can run, and adds a Go job to the PR CI. This unblocks the Go unit-testing follow-up from the earlier CI PR.

Modules

Module Deps go floor
gomod-doccopy stdlib only 1.23
hack-vendor (both cmd/ tools) github.com/BurntSushi/toml v1.6.0 1.23
govendor-override archived github.com/golang/dep v0.5.0 (+ transitive) 1.25.0

Each tool is its own module, matching the "cd + go install" workflow in the READMEs and isolating dep's heavy tree.

The tricky part — govendor-override

dep's gps package compiles only against the old Masterminds/semver API (NewConstraintIC, IsNone, value-type Version). Modules resolved semver to v1.5.0, which broke the build. Fix: pin semver to the exact revision dep v0.5.0 vendored (v0.0.0-20180403015459-24642bd05731) — the one essential pin. Everything else rides current versions; that pulls in golang.org/x/sync, which sets the module floor at Go 1.25.0.

Cleanup

  • Removes the now-obsolete govendor-override/Gopkg.{toml,lock}.
  • Keeps govendor-override/testdata/*.template.toml — those are the tool's test fixtures.

CI

Adds a go matrix job (.github/workflows/ci.yml) running build/vet/test per module on Go 1.25 (satisfies all three). go build defaults to -mod=readonly, so it fails on a stale/incomplete go.mod — no mutating go mod tidy in CI (brittle across toolchain patches).

Verification (local)

All three modules pass go build -mod=readonly ./..., go vet ./..., go test ./.... No test files exist yet, so go test passes trivially — this establishes the foundation.

Follow-ups

  • Add real Go unit tests (gomod-doccopy path logic; govendor-override, which already ships testdata/).

🤖 Generated with Claude Code

The three Go tools were built with `dep` (Gopkg.toml/lock) and had no
go.mod, so `go build`/`go test` could not run in modules mode. This
migrates each to its own module (matching their "cd + go install"
workflow) and wires them into the PR CI added earlier.

- gomod-doccopy: stdlib only (go 1.23).
- hack-vendor: covers both cmd/ tools; requires BurntSushi/toml (go 1.23).
- govendor-override: requires the archived github.com/golang/dep v0.5.0.
  dep's gps package needs the old Masterminds/semver API, so semver is
  pinned to the revision dep vendored (v0.0.0-20180403...24642bd); every
  other dep rides current versions. This pulls in golang.org/x/sync,
  which sets the module's floor at go 1.25.0.

Removes the now-obsolete govendor-override/Gopkg.{toml,lock}. The
testdata/*.template.toml files are test fixtures and are kept.

Adds a `go` matrix job to .github/workflows/ci.yml that runs
build/vet/test per module on Go 1.25 (satisfies all three). `go build`
runs -mod=readonly by default, so it fails on a stale/incomplete go.mod.

Verified locally: build, vet, and test pass for all three modules
(no test files yet -> tests pass trivially; unit tests are a follow-up).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mholloway24
mholloway24 merged commit 23a1b13 into master Jul 13, 2026
7 checks passed
@mholloway24
mholloway24 deleted the mh/go-modules branch July 13, 2026 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant