MCPcopy Index your code
hub / github.com/chain/Core / BoolVar

Function BoolVar

env/env.go:63–76  ·  view source on GitHub ↗

BoolVar defines a bool var with the specified name and default value. The argument p points to a bool variable in which to store the value of the environment variable.

(p *bool, name string, value bool)

Source from the content-addressed store, hash-verified

61// to a bool variable in which to store the value
62// of the environment variable.
63func BoolVar(p *bool, name string, value bool) {
64 *p = value
65 funcs = append(funcs, func() bool {
66 if s := os.Getenv(name); s != "" {
67 v, err := strconv.ParseBool(s)
68 if err != nil {
69 log.Println(name, err)
70 return false
71 }
72 *p = v
73 }
74 return true
75 })
76}
77
78// Duration returns the value of the named environment variable,
79// interpreted as a time.Duration (using time.ParseDuration).

Callers 2

BoolFunction · 0.85
TestBoolVarFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestBoolVarFunction · 0.68