String prints the attribute map. If any key or values throughout the map implement fmt.Stringer, it calls that method and appends.
()
| 122 | // String prints the attribute map. If any key or values throughout the map |
| 123 | // implement fmt.Stringer, it calls that method and appends. |
| 124 | func (a *Attributes) String() string { |
| 125 | var sb strings.Builder |
| 126 | sb.WriteString("{") |
| 127 | first := true |
| 128 | for k, v := range a.all() { |
| 129 | if !first { |
| 130 | sb.WriteString(", ") |
| 131 | } |
| 132 | fmt.Fprintf(&sb, "%q: %q ", str(k), str(v)) |
| 133 | first = false |
| 134 | } |
| 135 | sb.WriteString("}") |
| 136 | return sb.String() |
| 137 | } |
| 138 | |
| 139 | func str(x any) (s string) { |
| 140 | if v, ok := x.(fmt.Stringer); ok { |
no test coverage detected