Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Goであると思ってたけど、なかった関数、定数 expandPath
import (
"os/user"
"strings"
)
func expandPath(path string) string {
usr, _ := user.Current()
return strings.Replace(path, "~", usr.HomeDir, 1)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment