kelseyhightower / envconfig

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

Differentiate between empty and unset values. #29

Closed jenanwise closed 8 years ago

jenanwise commented 8 years ago

The previous implementation used os.Getenv, which does not differentiate between an empty and an unset environment variable -- both return the empty string with os.Getenv.

The new implementation uses syscall.Getenv, which is what os.Getenv uses directly under the hood. go1.5 introduced os.LookupEnv to solve this exact problem, but it has not been backported.

See golang discussion in golang/go#9676.

teepark commented 8 years ago

I merged this with a tweak, think I missed the merge commit though so github didn't recognize it.