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)
| 61 | // to a bool variable in which to store the value |
| 62 | // of the environment variable. |
| 63 | func 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). |
no outgoing calls