diff --git a/gopmod/module.go b/gopmod/module.go index 9a5e46f..1fe3007 100644 --- a/gopmod/module.go +++ b/gopmod/module.go @@ -17,6 +17,7 @@ package gopmod import ( + "fmt" "log" "path/filepath" "runtime" @@ -130,7 +131,7 @@ func (p *Module) lookupExternPkg(pkgPath string) (pkg *Package, err error) { return } } - err = &mod.MissingPkgError{Path: pkgPath} + err = &MissingError{Path: pkgPath} return } @@ -210,4 +211,13 @@ func loadModFrom(mod module.Version, mode mod.Mode) (p *Module, err error) { return Load(dir, mode) } +type MissingError struct { + Path string +} + +func (e *MissingError) Error() string { + return fmt.Sprintf(`no required module provides package %v; to add it: + gop get %v`, e.Path, e.Path) +} + // ----------------------------------------------------------------------------- diff --git a/mod.go b/mod.go index cb0225c..17ff88e 100644 --- a/mod.go +++ b/mod.go @@ -17,7 +17,6 @@ package mod import ( - "fmt" "os" "path/filepath" "strings" @@ -69,13 +68,4 @@ func GOMOD(dir string) (file string, err error) { return GOPMOD(dir, GoModOnly) } -type MissingPkgError struct { - Path string -} - -func (e *MissingPkgError) Error() string { - return fmt.Sprintf(`no required module provides package %v; to add it: - go get %v`, e.Path, e.Path) -} - // -----------------------------------------------------------------------------