mirror of
https://gitee.com/johng/gf
synced 2026-06-07 02:12:11 +08:00
add golangci feature to guarantee codes quality (#2229)
This commit is contained in:
@ -118,11 +118,11 @@ func GetArgAll() []string {
|
||||
// 1. Command line arguments are in lowercase format, eg: gf.package.variable;
|
||||
// 2. Environment arguments are in uppercase format, eg: GF_PACKAGE_VARIABLE;
|
||||
func GetOptWithEnv(key string, def ...string) string {
|
||||
cmdKey := strings.ToLower(strings.Replace(key, "_", ".", -1))
|
||||
cmdKey := strings.ToLower(strings.ReplaceAll(key, "_", "."))
|
||||
if ContainsOpt(cmdKey) {
|
||||
return GetOpt(cmdKey)
|
||||
} else {
|
||||
envKey := strings.ToUpper(strings.Replace(key, ".", "_", -1))
|
||||
envKey := strings.ToUpper(strings.ReplaceAll(key, ".", "_"))
|
||||
if r, ok := os.LookupEnv(envKey); ok {
|
||||
return r
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user