Dereference Flag
s if they are pointers
When checking if environment variables are set. We don't support pointer flags currently (though this is the default in the `v2` branch), but this fixes #516
This commit is contained in:
parent
c723b19a84
commit
e7b1833f53
@ -79,7 +79,12 @@ func (c *Context) IsSet(name string) bool {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
envVarValue := reflect.ValueOf(f).FieldByName("EnvVar")
|
val := reflect.ValueOf(f)
|
||||||
|
if val.Kind() == reflect.Ptr {
|
||||||
|
val = val.Elem()
|
||||||
|
}
|
||||||
|
|
||||||
|
envVarValue := val.FieldByName("EnvVar")
|
||||||
if !envVarValue.IsValid() {
|
if !envVarValue.IsValid() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user