chore: use errors.New to replace fmt.Errorf with no parameters (#4204)

Signed-off-by: RiceChuan <lc582041246@gmail.com>
This commit is contained in:
leo 2024-12-24 13:17:00 +08:00 committed by GitHub
parent d54d20abea
commit b287d6419b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 15 additions and 12 deletions

View file

@ -38,7 +38,7 @@ func Error2(v interface{}, err error) error {
func envFile() (string, error) {
if file := os.Getenv("GOENV"); file != "" {
if file == "off" {
return "", fmt.Errorf("GOENV=off")
return "", errors.New("GOENV=off")
}
return file, nil
}
@ -47,7 +47,7 @@ func envFile() (string, error) {
return "", err
}
if dir == "" {
return "", fmt.Errorf("missing user-config dir")
return "", errors.New("missing user-config dir")
}
return filepath.Join(dir, "go", "env"), nil
}
@ -60,7 +60,7 @@ func GetRuntimeEnv(key string) (string, error) {
return "", err
}
if file == "" {
return "", fmt.Errorf("missing runtime env file")
return "", errors.New("missing runtime env file")
}
var data []byte
var runtimeEnv string