code: func cleanAndExpandPath(path string) string {
  	// Expand initial ~ to OS specific home directory.
  	if strings.HasPrefix(path, "~") {
  		homeDir := filepath.Dir(defaultHomeDir)
  		path = strings.Replace(path, "~", homeDir, 1)
  	}
  
  	// NOTE: The os.ExpandEnv doesn't work with Windows-style %VARIABLE%,
  	// but they variables can still be expanded via POSIX-style $VARIABLE.
  	return filepath.Clean(os.ExpandEnv(path))
  }
docs: // cleanAndExpandPath expands environment variables and leading ~ in the
  // passed path, cleans the result, and returns it.