We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 67fe8b5 commit ef99381Copy full SHA for ef99381
src/os/example_test.go
@@ -82,6 +82,24 @@ func init() {
82
os.Unsetenv("GOPATH")
83
}
84
85
+func ExampleExpand() {
86
+ mapper := func(placeholderName string) string {
87
+ switch placeholderName {
88
+ case "DAY_PART":
89
+ return "morning"
90
+ case "USER":
91
+ return "Gopher"
92
+ }
93
+
94
+ return ""
95
96
97
+ fmt.Println(os.Expand("Good ${DAY_PART}, $USER!", mapper))
98
99
+ // Output:
100
+ // Good morning, Gopher!
101
+}
102
103
func ExampleExpandEnv() {
104
fmt.Println(os.ExpandEnv("$USER lives in ${HOME}."))
105
0 commit comments