Closed carlca closed 6 years ago
Can you share some code that reproduces the issue? If os.Getenv
doesn't work then it's pretty unlikely that envconfig will.
Thanks for the reply. Just the example script and code on the page https://github.com/kelseyhightower/envconfig will show the problem. I suspect this is a deep underlying problme with macOS, rather than any code here.
Can you eliminate variables here? I just got it to work on OS X 10.12.6 and go 1.9.2, you may not be able to try a different OS version but can you see if it works on your machine under go 1.9?
One other thing comes to mind: what shell do you use? It could be that the export
syntax in the README doesn't get picked up by your shell, so the go program never sees them and prints out zero values.
I think your second suggestion is significant here. I'm using ZSH as my shell, and others have suggested this may be the problem. I guess I'll have to pester the ZSH people...!
I received this post in another forum. Seems to answer the question.
https://forum.golangbridge.org/u/NobbZ
tl;dr
source env.sh
go run main.go
macOS 10.13.3 High Sierra Golang go1.10rc1
When I run the example app, it just gives me the zero-values for the struct, not the values from the export commands. I seem to remember I had similar problems when I used
os.Getenv
but I had hoped this package solved those problems.