-
Notifications
You must be signed in to change notification settings - Fork 391
Open
Description
Consider such struct
type Something struct {
User string `envconfig:"user"`
}
something := Something{}
err := envconfig.Process("my_app", &something)
I'd expect that if MY_APP_USER env is not set, the something.User will be empty, but that's not the case. Due to this line https://github.com/kelseyhightower/envconfig/blob/master/envconfig.go#L99 the Alt is set to user. Process method https://github.com/kelseyhightower/envconfig/blob/master/envconfig.go#L195 first try to find by Key (which is MY_APP_USER), but then by Alt, so when MY_APP_USER is not available, then the USER is looked up. On MacOS USER this is set to your username, so instead of empty string I see my username.
Is this expected behaviour?
Metadata
Metadata
Assignees
Labels
No labels