GetOrAppendObservations returns a pointer to the existing Observations structure in the CmdExtras, or appends and returns a pointer to a new observations structure if the CmdExtras does not already contain one.
()
| 90 | // structure in the CmdExtras, or appends and returns a pointer to a new |
| 91 | // observations structure if the CmdExtras does not already contain one. |
| 92 | func (e *CmdExtras) GetOrAppendObservations() *CmdObservations { |
| 93 | if o := e.Observations(); o != nil { |
| 94 | return o |
| 95 | } |
| 96 | o := &CmdObservations{} |
| 97 | e.Add(o) |
| 98 | return o |
| 99 | } |
| 100 | |
| 101 | // WithExtras adds the given extras to a command and returns it. |
| 102 | func WithExtras(a Cmd, extras ...CmdExtra) Cmd { |
no test coverage detected