MCPcopy Create free account
hub / github.com/docker/cli / Set

Method Set

opts/duration.go:16–25  ·  view source on GitHub ↗

Set a new value on the option. Setting a negative duration value will cause an error to be returned.

(s string)

Source from the content-addressed store, hash-verified

14// Set a new value on the option. Setting a negative duration value will cause
15// an error to be returned.
16func (d *PositiveDurationOpt) Set(s string) error {
17 err := d.DurationOpt.Set(s)
18 if err != nil {
19 return err
20 }
21 if *d.DurationOpt.value < 0 {
22 return errors.New("duration cannot be negative")
23 }
24 return nil
25}
26
27// DurationOpt is an option type for time.Duration that uses a pointer. This
28// allows us to get nil values outside, instead of defaulting to 0

Callers 1

Calls 1

SetMethod · 0.45

Tested by 1