Skip to content

Bug: Unreliable code for resolving glide home #736

Description

@krancour

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions