WithValue returns a new Attributes containing the previous keys and values and the new key/value pair. If the same key appears multiple times, the last value overwrites all previous values for that key. value should not be modified later. Note that Attributes do not support deletion. Avoid using
(key, value any)
| 63 | // storing a specific sentinel type or a wrapper struct with a boolean field |
| 64 | // indicating presence. |
| 65 | func (a *Attributes) WithValue(key, value any) *Attributes { |
| 66 | return &Attributes{ |
| 67 | parent: a, |
| 68 | key: key, |
| 69 | value: value, |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | // Value returns the value associated with these attributes for key, or nil if |
| 74 | // no value is associated with key. The returned value should not be modified. |
no outgoing calls