()
| 71 | } |
| 72 | |
| 73 | func ExampleSetter() { |
| 74 | var config Config |
| 75 | if err := defaults.Set(&config); err != nil { |
| 76 | panic(err) |
| 77 | } |
| 78 | fmt.Println(config.Retries, config.Backoff) |
| 79 | |
| 80 | // A value the caller supplied is left alone. |
| 81 | custom := Config{Backoff: time.Minute} |
| 82 | if err := defaults.Set(&custom); err != nil { |
| 83 | panic(err) |
| 84 | } |
| 85 | fmt.Println(custom.Retries, custom.Backoff) |
| 86 | // Output: |
| 87 | // 3 3s |
| 88 | // 3 1m0s |
| 89 | } |
| 90 | |
| 91 | func ExampleCanUpdate() { |
| 92 | fmt.Println(defaults.CanUpdate(0), defaults.CanUpdate(123)) |