golang-github-mitchellh-go-homedir-dev

Go library for detecting and expanding the user's home directory
  https://github.com/mitchellh/go-homedir
  0
  no reviews



This is a go library for detecting the user's home directory without the use of cgo, so the library can be used in cross-compilation environments.

usage is incredibly simple, just call homedir.dir() to get the home directory for a user, and homedir.expand() to expand the ~ in a path to the home directory.

why not just use os/user? the built-in os/user package requires cgo on darwin systems. this means that any go code that uses that package cannot cross compile. but 99% of the time the use for os/user is just to retrieve the home directory, which we can do for the current user without cgo. this library does that, enabling cross-compilation.