homedir.go
func Dir() (string, error) {
	currentUser, err := user.Current()
	if err != nil {
		return "", err
	}
	if currentUser.HomeDir == "" {
		return "", errors.New("cannot find user-specific home dir")
	}

	return currentUser.HomeDir, nil
}
func Dir() (string, error) {
	currentUser, err := user.Current()
	if err != nil {
		return "", err
	}
	if currentUser.HomeDir == "" {
		return "", errors.New("cannot find user-specific home dir")
	}

	return currentUser.HomeDir, nil
}
func Dir ( ) ( string , error ) { currentUser , err := user . Current ( ) if err != nil { return " " , err } if currentUser . HomeDir == " " { return " " , errors . New ( " " ) } return currentUser . HomeDir , nil }
// Dir returns the home directory for the executing user.
// An error is returned if a home directory cannot be detected.
Dir returns the home directory for the executing user . An error is returned if a home directory cannot be detected .