mirror of
https://github.com/astaxie/beego.git
synced 2024-12-22 22:50:50 +00:00
optimization code
This commit is contained in:
parent
484ca3a643
commit
1222c87be3
@ -119,9 +119,8 @@ func Getenv(env interface{}) (string, bool) {
|
||||
|
||||
// Onley support string key.
|
||||
if key, ok := env.(string); ok {
|
||||
if len(key) > len(envKeySign) && strings.HasPrefix(key, envKeySign) {
|
||||
key = strings.TrimLeft(key, envKeySign)
|
||||
return os.Getenv(key), true
|
||||
if envKey := strings.TrimPrefix(key, envKeySign); envKey != key {
|
||||
return os.Getenv(envKey), true
|
||||
}
|
||||
}
|
||||
return "", false
|
||||
|
Loading…
Reference in New Issue
Block a user