commit | 214ec585c2295bbda6e43301d35229cd43d6c670 | [log] [tgz] |
---|---|---|
author | Mitchell Hashimoto <xmitchx@gmail.com> | Sat Sep 13 16:50:19 2014 |
committer | Mitchell Hashimoto <xmitchx@gmail.com> | Sat Sep 13 16:50:19 2014 |
tree | 384c667401d6e30040e5a6e38244e917b61fd62c | |
parent | 0af1630672c20c57b4f10c2afba2264516562918 [diff] | |
parent | ec9ca951700e169c26519c207dd1002c3f541890 [diff] |
Merge pull request #2 from bredov/pull-request Fix Expand for path of len <= 1.
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.