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

@ -1,6 +1,7 @@
package main
import (
"errors"
"flag"
"fmt"
"go/build"
@ -18,7 +19,7 @@ var directory = flag.String("pwd", "", "Working directory of Xray vformat.")
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
}
@ -27,7 +28,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
}
@ -40,7 +41,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