1
0
mirror of https://github.com/astaxie/beego.git synced 2024-06-13 21:13:33 +00:00

optimization code

This commit is contained in:
ysqi 2016-01-28 14:49:44 +08:00
parent 484ca3a643
commit 1222c87be3

View File

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