kelseyhightower / envconfig

Golang library for managing configuration data from environment variables
MIT License
5.02k stars 377 forks source link

Empty string for required fields #71

Closed yanpozka closed 7 years ago

yanpozka commented 7 years ago

So far if we export an environment variable with an empty value the required tag will not complaint. For example in this sceneario, Process() method will not return an error. Is this an expected behavior ?

export MYAPP_USER=
export MYAPP_USERS=""
type Specification struct {
    User    string
    Users   []string
}
teepark commented 7 years ago

Yes, this is intentional. The empty string is still a value, and required only asserts that the variable exists. See #29.

Want to make this more clear in the README? I'd happily merge a PR for that.