MCPcopy
hub / github.com/grpc/grpc-go / String

Method String

attributes/attributes.go:124–137  ·  view source on GitHub ↗

String prints the attribute map. If any key or values throughout the map implement fmt.Stringer, it calls that method and appends.

()

Source from the content-addressed store, hash-verified

122// String prints the attribute map. If any key or values throughout the map
123// implement fmt.Stringer, it calls that method and appends.
124func (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
139func str(x any) (s string) {
140 if v, ok := x.(fmt.Stringer); ok {

Callers 1

MarshalJSONMethod · 0.95

Calls 3

allMethod · 0.95
strFunction · 0.70
StringMethod · 0.65

Tested by

no test coverage detected