1
0
mirror of https://github.com/golang/go synced 2024-11-18 13:04:46 -07:00

os: fix docs for Expand

there is no concept of “undefined” variables for Expand。

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6946063
This commit is contained in:
Shenghou Ma 2012-12-17 23:37:02 +08:00
parent a89aaad195
commit 57ae2e7371

View File

@ -9,7 +9,7 @@ package os
import "syscall"
// Expand replaces ${var} or $var in the string based on the mapping function.
// Invocations of undefined variables are replaced with the empty string.
// For example, os.ExpandEnv(s) is equivalent to os.Expand(s, os.Getenv).
func Expand(s string, mapping func(string) string) string {
buf := make([]byte, 0, 2*len(s))
// ${} is all ASCII, so bytes are fine for this operation.