code: func expandHome(p string) string {
  	if strings.HasPrefix(p, "~/") || strings.HasPrefix(p, "~\\") {
  		home := os.Getenv("HOME")
  		if home == "" {
  			if usr, err := user.Current(); err == nil {
  				home = usr.HomeDir
  			}
  		}
  		if home != "" {
  			p = home + p[1:]
  		}
  	}
  	return filepath.Clean(p)
  }
docs: // expands home directory in file paths.
  // ~someuser/tmp will not be expanded.