Here's a nice, concise way to do this (if you only work on a UNIX-based system):
import ( "os" ) var home string = os.Getenv("HOME")
It just queries the $ HOME environment variable.
--- Edit ---
Now I see that the same method was proposed above. I will leave this example here as a distilled solution.
splodingsocks Oct 03 '13 at 18:27 2013-10-03 18:27
source share