#8 up logger.

This commit is contained in:
Gorbunov Kirill Andreevich 2024-03-17 16:46:46 +03:00
parent f1a384c3c4
commit 1680270c0a
2 changed files with 7 additions and 7 deletions

View File

@ -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
@ -168,7 +168,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()
@ -198,7 +198,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
@ -218,9 +218,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
@ -232,7 +232,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.

View File

@ -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
} }