I recently had to move private repositories from SaaS Gitlab to an on-premise version. Everything was going well where I did:
- Update old go module paths in repo
afromold.com/workspace/atonew.com/workspace/a - Add a new tag
v1.2.3-newto the latest commit - Update repo
bto reference latest tagv1.2.3-newfromnew.com/workspace/a - Run
go mod tidyin repoband verify it works
Now I have a requirement to reference an older version tag of new.com/workspace/a (originally old.com/workspace/a). So in repo a, I checked out the older tag, fixed up the module path to new.com/workspace/a from old.com/workspace/a and tagged it as v1.1.1-new.
In repo b then I referenced new.com/workspace/a with v1.1.1-new. However, this results in:
go: new.com/workspace/a@v1.1.1-new: parsing go.mod:
module declares its path as: old.com/workspace/b
but was required as: new.com/workspace/b
If I check the v1.1.1-new tag in repo a, the module path is set correctly in the go.modfile:
module new.com/workspace/a
It is unclear to me why it works with the tag v1.2.3-new on the latest commit but fails when I reference an older commit.