A package for finding and manipulating go.mod files.
- Recursively traverses up the filesystem looking for
go.mod - Supports resolving import paths to directories
- Supports resolving directories to import paths
- Extracted from Bud
go get github.com/livebud/modfunc main() {
module, err := mod.Find(".")
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
fmt.Println(module.Dir())
fmt.Println(module.Import())
}- Matt Mueller (@mattmueller)
MIT