about summary refs log tree commit diff
path: root/gopkgs
diff options
context:
space:
mode:
Diffstat (limited to 'gopkgs')
-rw-r--r--gopkgs/utils/utils.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/gopkgs/utils/utils.go b/gopkgs/utils/utils.go
index 404fd8bf0a12..7ac9defa6f0f 100644
--- a/gopkgs/utils/utils.go
+++ b/gopkgs/utils/utils.go
@@ -7,8 +7,18 @@ import (
 	"log"
 	"net/http"
 	"net/http/httputil"
+	"os/user"
 )
 
+// Return the absolute path to the current uesr's home directory.
+func HomeDir() string {
+	user, err := user.Current()
+	if err != nil {
+		log.Fatal(err)
+	}
+	return user.HomeDir
+}
+
 // Call log.Fatal with `err` when it's not nil.
 func FailOn(err error) {
 	if err != nil {