#19 #20
@ -145,7 +145,7 @@ func Query(modpath string, cached bool) (*Module, bool, error) {
|
|||||||
if msg == "" {
|
if msg == "" {
|
||||||
msg = res.Status
|
msg = res.Status
|
||||||
}
|
}
|
||||||
return nil, false, fmt.Error("proxy: %s", msg)
|
return nil, false, fmt.Errorf("proxy: %s", msg)
|
||||||
}
|
}
|
||||||
var mod Module
|
var mod Module
|
||||||
mod.Path = modpath
|
mod.Path = modpath
|
||||||
@ -167,7 +167,7 @@ func Latest(modpath string, cached bool) (*Module, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if !ok {
|
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++ {
|
for i := 0; i < 100; i++ {
|
||||||
nextpath, ok := latest.NextMajorPath()
|
nextpath, ok := latest.NextMajorPath()
|
||||||
@ -197,7 +197,7 @@ func Latest(modpath string, cached bool) (*Module, error) {
|
|||||||
}
|
}
|
||||||
latest = next
|
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
|
// QueryPackage tries to find the module path for the provided package path
|
||||||
@ -217,9 +217,9 @@ func QueryPackage(pkgpath string, cached bool) (*Module, error) {
|
|||||||
if major, ok := ModMajor(modpath); ok {
|
if major, ok := ModMajor(modpath); ok {
|
||||||
if v := mod.MaxVersion(major, false); v != "" {
|
if v := mod.MaxVersion(major, false); v != "" {
|
||||||
spec := JoinPath(modprefix, "", pkgdir) + "@" + 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
|
return mod, nil
|
||||||
@ -231,7 +231,7 @@ func QueryPackage(pkgpath string, cached bool) (*Module, error) {
|
|||||||
}
|
}
|
||||||
prefix = strings.TrimSuffix(remaining, "/")
|
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.
|
// Update reports a newer version of a module.
|
||||||
|
@ -108,7 +108,7 @@ func FindModFile(dir string) (string, error) {
|
|||||||
}
|
}
|
||||||
parent := filepath.Dir(dir)
|
parent := filepath.Dir(dir)
|
||||||
if parent == dir {
|
if parent == dir {
|
||||||
return "", fmt.Error("cannot find go.mod")
|
return "", fmt.Errorf("cannot find go.mod")
|
||||||
}
|
}
|
||||||
dir = parent
|
dir = parent
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user