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

Bug: Unreliable code for resolving glide home #736

Closed
krancour opened this issue Jan 12, 2017 · 1 comment
Closed

Bug: Unreliable code for resolving glide home #736

krancour opened this issue Jan 12, 2017 · 1 comment

Comments

@krancour
Copy link
Contributor

The following code, which resolves the location of the glide home when the GLIDE_HOME environment variable is not set, is unreliable. It uses os/user, which in turn uses cgo, which doesn't work when cross-compiling, which I assume you must be doing.

https://github.com/Masterminds/glide/blob/master/path/path.go#L40-L62

The result is that glide home resolves as documented on a Mac, but on a Linux machine (which, of course, includes any Docker container), the logic above falls back to resolving the glide home as filepath.Join(cwd, ".glide").

While that's not entirely inconvenient, it is, to say the least, surprising and undocumented OS-specific behavior.

This could be corrected by abandoning the use of os/user in favor of https://github.com/mitchellh/go-homedir, which does not rely on cgo.

@mattfarina @technosophos I'd be happy to submit a PR for this if you agree with my assessment of the problem and my proposed solution.

@mattfarina
Copy link
Member

@krancour this was on my todo list for the exact reason you describe and the package from mitchellh was the one I was looking at.

If you submit a PR I'd be happy review so we can get it in

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