Documentation
¶
Overview ¶
modrename gives a forked Go module its new module path, everywhere the path is a module path and nowhere it is not.
modrename --from github.com/ajroetker/go-highway --to github.com/go-simd/highway DIR # report modrename --from github.com/ajroetker/go-highway --to github.com/go-simd/highway --write DIR # rewrite
A fork that its consumers can actually use needs a new module path: a `replace` in OUR go.mod never reaches the modules that depend on ours, which is precisely the defect that made go-highway worth forking (its replace of hwy/goat reached nobody). So every import, every go.mod, every documented `go get` changes -- 2032 files in go-highway.
What is NOT a module path is left alone, deliberately: an occurrence inside a file-system path. go-highway's 605 generated assembly files record where they were generated from,
// /Users/ajroetker/go/src/github.com/ajroetker/go-highway/hwy/contrib/...
and rewriting that would invent a path that never existed on anybody's machine. The rule is mechanical: an occurrence directly preceded by '/' is a file path, not a module path.
It works on the files git tracks, refuses a dirty tree (so its diff is exactly its own), never follows the path into a longer name (go-highway2 is not go-highway), and only rewrites go.mod, .go and .md files -- the places a module path means something. Without --write it reports what it would change and exits 1 if anything would.