#8 delete cobra, add micro-config-flag #11
@ -145,7 +145,7 @@ func Query(modpath string, cached bool) (*Module, bool, error) {
|
||||
if msg == "" {
|
||||
msg = res.Status
|
||||
}
|
||||
return nil, false, fmt.Error("proxy: %s", msg)
|
||||
return nil, false, fmt.Errorf("proxy: %s", msg)
|
||||
}
|
||||
var mod Module
|
||||
mod.Path = modpath
|
||||
@ -168,7 +168,7 @@ func Latest(modpath string, cached bool) (*Module, error) {
|
||||
return nil, err
|
||||
}
|
||||
if !ok {
|
||||
return nil, fmt.Error("module not found: %s", modpath)
|
||||
return nil, fmt.Errorf("module not found: %s", modpath)
|
||||
}
|
||||
for i := 0; i < 100; i++ {
|
||||
nextpath, ok := latest.NextMajorPath()
|
||||
@ -198,7 +198,7 @@ func Latest(modpath string, cached bool) (*Module, error) {
|
||||
}
|
||||
latest = next
|
||||
}
|
||||
return nil, fmt.Error("request limit exceeded")
|
||||
return nil, fmt.Errorf("request limit exceeded")
|
||||
}
|
||||
|
||||
// QueryPackage tries to find the module path for the provided package path
|
||||
@ -218,9 +218,9 @@ func QueryPackage(pkgpath string, cached bool) (*Module, error) {
|
||||
if major, ok := ModMajor(modpath); ok {
|
||||
if v := mod.MaxVersion(major, false); v != "" {
|
||||
spec := JoinPath(modprefix, "", pkgdir) + "@" + v
|
||||
return nil, fmt.Error("%s doesn't support import versioning; use %s", major, spec)
|
||||
return nil, fmt.Errorf("%s doesn't support import versioning; use %s", major, spec)
|
||||
}
|
||||
return nil, fmt.Error("failed to find module for package: %s", pkgpath)
|
||||
return nil, fmt.Errorf("failed to find module for package: %s", pkgpath)
|
||||
}
|
||||
}
|
||||
return mod, nil
|
||||
@ -232,7 +232,7 @@ func QueryPackage(pkgpath string, cached bool) (*Module, error) {
|
||||
}
|
||||
prefix = strings.TrimSuffix(remaining, "/")
|
||||
}
|
||||
return nil, fmt.Error("failed to find module for package: %s", pkgpath)
|
||||
return nil, fmt.Errorf("failed to find module for package: %s", pkgpath)
|
||||
}
|
||||
|
||||
// Update reports a newer version of a module.
|
||||
|
@ -108,7 +108,7 @@ func FindModFile(dir string) (string, error) {
|
||||
}
|
||||
parent := filepath.Dir(dir)
|
||||
if parent == dir {
|
||||
return "", fmt.Error("cannot find go.mod")
|
||||
return "", fmt.Errorf("cannot find go.mod")
|
||||
}
|
||||
dir = parent
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user