commit | 7d2d8c8a4e078ce3c58736ab521a40b37a504c52 | [log] [tgz] |
---|---|---|
author | Mitchell Hashimoto <mitchell.hashimoto@gmail.com> | Sat Sep 13 09:59:50 2014 -0700 |
committer | Mitchell Hashimoto <mitchell.hashimoto@gmail.com> | Sat Sep 13 09:59:50 2014 -0700 |
tree | 6180828c69ac4899f9e9d0922a951acf0d38aa69 | |
parent | 214ec585c2295bbda6e43301d35229cd43d6c670 [diff] |
Just make len 0 a special case
diff --git a/homedir.go b/homedir.go index 3621a70..b6d3502 100644 --- a/homedir.go +++ b/homedir.go
@@ -26,7 +26,11 @@ // is prefixed with `~`. If it isn't prefixed with `~`, the path is // returned as-is. func Expand(path string) (string, error) { - if len(path) == 0 || path[0] != '~' { + if len(path) == 0 { + return path, nil + } + + if path[0] != '~' { return path, nil }