Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't appear to work under macOS #102

Closed
carlca opened this issue Feb 5, 2018 · 5 comments
Closed

Doesn't appear to work under macOS #102

carlca opened this issue Feb 5, 2018 · 5 comments

Comments

@carlca
Copy link

carlca commented Feb 5, 2018

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.

@teepark
Copy link
Collaborator

teepark commented Feb 5, 2018

Can you share some code that reproduces the issue? If os.Getenv doesn't work then it's pretty unlikely that envconfig will.

@carlca
Copy link
Author

carlca commented Feb 5, 2018

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.

@teepark
Copy link
Collaborator

teepark commented Feb 5, 2018

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.

@carlca
Copy link
Author

carlca commented Feb 6, 2018

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...!

@carlca
Copy link
Author

carlca commented Feb 6, 2018

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

@carlca carlca closed this as completed Feb 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants