Help us shape the future of Go! Take the 2026 Go Developer Survey

modrename

command
v0.69.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2026 License: BSD-3-Clause Imports: 11 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL