github.com/govau/cf-common@v0.0.7/env/opts_example_test.go (about) 1 package env_test 2 3 import ( 4 "fmt" 5 "os" 6 7 "github.com/govau/cf-common/env" 8 ) 9 10 func ExampleWithOSLookup() { 11 os.Setenv("FOO", "bar") // Simulate OS env. 12 13 vs := env.NewVarSet(env.WithOSLookup()) 14 15 v := vs.MustString("FOO") 16 17 fmt.Println(v) 18 } 19 20 func ExampleWithMapLookup() { 21 m := map[string]string{ 22 "FOO": "bar", 23 } 24 25 vs := env.NewVarSet(env.WithMapLookup(m)) 26 27 v := vs.MustString("FOO") 28 29 fmt.Println(v) 30 }