Skip to content

Commit

Permalink
mod.MissingPkgError => gopmod.MissingError
Browse files Browse the repository at this point in the history
  • Loading branch information
visualfc committed Jun 9, 2022
1 parent d3dfb69 commit d3d5d45
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
12 changes: 11 additions & 1 deletion gopmod/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package gopmod

import (
"fmt"
"log"
"path/filepath"
"runtime"
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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)
}

// -----------------------------------------------------------------------------
10 changes: 0 additions & 10 deletions mod.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package mod

import (
"fmt"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -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)
}

// -----------------------------------------------------------------------------

0 comments on commit d3d5d45

Please sign in to comment.