fix(module): rename to /v2 import path for semantic import versioning#6
Merged
Conversation
v2.0.0 was tagged with the v1-style module path 'github.com/benedoc-inc/pdfer', so the Go proxy rejects it with "module path must match major version". Rename go.mod to 'github.com/benedoc-inc/pdfer/v2' and rewrite all internal imports, README badges, install commands, and the modulePath constant used by Version(). Add a semantic-import-versioning guard to release.yml that refuses to tag vN.x.x (N>=2) when go.mod's module path doesn't end in /vN, and refuses v1.x.x when it does. This prevents repeating the broken-release situation. The orphaned v2.0.0 tag and release will be removed separately before re-cutting v2.0.0 from this commit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
v2.0.0 was tagged from
mainwhilego.modstill declared the module path asgithub.com/benedoc-inc/pdfer(no/v2suffix). Go's semantic import versioning requires major version ≥ 2 to encode the version in the import path. The proxy refused the release with module path must match major version; the tag has since been rolled back.This PR fixes the module path and adds a CI guard so the next attempt can't repeat the same mistake.
What changed
Module rename (
go.mod+ ~140 files):go.modmodule path →github.com/benedoc-inc/pdfer/v2CLAUDE.mdexample import updatedpdfer.gomodulePathconstant (used byVersion()to find itself inruntime/debug.BuildInfo) updatedRelease-workflow guard (
.github/workflows/release.yml):A new Enforce semantic import versioning step refuses to tag:
vN.x.x(N ≥ 2) whengo.mod's module path does not end in/vNv1.x.xwhengo.mod's module path does carry a/vNsuffixFails before the tag is created, so a misconfigured release stops cleanly instead of producing a broken artifact.
Test plan
go build ./...passesgo vet ./...passesgo test ./...passesgofmt -l .cleanv2.0.0via the Release workflow and confirm the guard passes; a v1.x dry-run should still pass tooNote
The orphaned
v2.0.0tag has already been deleted; re-cutting from this commit produces a clean release.🤖 Generated with Claude Code