code: func Expand(s string, env func(string) string) (string, error) {
  	p := syntax.NewParser()
  	word, err := p.Document(strings.NewReader(s))
  	if err != nil {
  		return "", err
  	}
  	if env == nil {
  		env = os.Getenv
  	}
  	cfg := &expand.Config{Env: expand.FuncEnviron(env)}
  	return expand.Document(cfg, word)
  }
docs: // Expand performs shell expansion on s as if it were within double quotes,
  // using env to resolve variables. This includes parameter expansion, arithmetic
  // expansion, and quote removal.
  //
  // If env is nil, the current environment variables are used. Empty variables
  // are treated as unset; to support variables which are set but empty, use the
  // expand package directly.
  //
  // Command subsitutions like $(echo foo) aren't supported to avoid running
  // arbitrary code. To support those, use an interpreter with the expand package.
  //
  // An error will be reported if the input string had invalid syntax.