Skip to content

fix(gen): parse go.mod files that use the ignore directive - #777

Open
orinnz wants to merge 2 commits into
stephenafamo:mainfrom
orinnz:fix/gomod-ignore-directive
Open

orinnz wants to merge 2 commits into
stephenafamo:mainfrom
orinnz:fix/gomod-ignore-directive

Conversation

@orinnz

@orinnz orinnz commented Oct 3, 2026 •

Copy link
Copy Markdown

Problem

Go 1.25 added the ignore directive to go.mod. bob pins golang.org/x/mod v0.24.0, which predates it, so generating into a module whose go.mod contains e.g. ignore data fails:

getting mod details: could not parse go.mod: .../go.mod:5: unknown directive: ignore

The only workaround today is to strip the ignore lines from go.mod before running bobgen and restore them afterwards.

Fix

  • Bump golang.org/x/mod v0.24.0 → v0.29.0. Support for ignore landed in v0.25.0; v0.29.0 is the newest release that still only needs Go 1.24, so bob's go 1.24.0 directive is unchanged. go mod tidy also moves x/tools, x/sync and x/sys up to match.
  • Add TestPackageForFolderWithIgnoreDirective in gen/language. It fails on main with the error above and passes with this change.
  • CHANGELOG entry under Unreleased → Fixed.

Testing

  • go build ./... and go vet ./gen/... pass.
  • go test ./gen/language/ ./gen/drivers/ ./gen/plugins/ pass.
  • I could not run the testcontainers-based driver tests locally (no Docker), so CI will cover those.

Go 1.25 added the `ignore` directive to go.mod. golang.org/x/mod v0.24.0
does not know it, so generation into such a module fails with
"could not parse go.mod: unknown directive: ignore".

Bump golang.org/x/mod to v0.29.0, the newest release that still only
requires Go 1.24, and add a test for PackageForFolder with an ignore line.
@orinnz
orinnz force-pushed the fix/gomod-ignore-directive branch from 8aa9285 to 3464342 Compare October 3, 2026 12:02
Comment thread gen/language/go_test.go Outdated
@orinnz
orinnz requested a review from stephenafamo October 12, 2026 12:34
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.

2 participants