mirror of https://github.com/grpc/grpc-go.git
attributes: avoid the use of %#v formatting verb (#6664)
This commit is contained in:
parent
147bd85912
commit
5e4402fffa
|
@ -127,7 +127,7 @@ func str(x any) (s string) {
|
|||
} else if v, ok := x.(string); ok {
|
||||
return v
|
||||
}
|
||||
return fmt.Sprintf("%#v", x)
|
||||
return fmt.Sprintf("<%p>", x)
|
||||
}
|
||||
|
||||
// MarshalJSON helps implement the json.Marshaler interface, thereby rendering
|
||||
|
|
|
@ -85,14 +85,14 @@ func ExampleAttributes_String() {
|
|||
fmt.Println("a7:", a7.String())
|
||||
fmt.Println("a8:", a8.String())
|
||||
// Output:
|
||||
// a1: {"attributes_test.key{}": "<nil>" }
|
||||
// a2: {"attributes_test.key{}": "<nil>" }
|
||||
// a3: {"attributes_test.key{}": "(*attributes_test.stringVal)(nil)" }
|
||||
// a4: {"attributes_test.key{}": "<nil>" }
|
||||
// a5: {"attributes_test.key{}": "1" }
|
||||
// a6: {"attributes_test.key{}": "two" }
|
||||
// a7: {"attributes_test.key{}": "attributes_test.stringVal{s:\"two\"}" }
|
||||
// a8: {"1": "true" }
|
||||
// a1: {"<%!p(attributes_test.key={})>": "<nil>" }
|
||||
// a2: {"<%!p(attributes_test.key={})>": "<nil>" }
|
||||
// a3: {"<%!p(attributes_test.key={})>": "<0x0>" }
|
||||
// a4: {"<%!p(attributes_test.key={})>": "<%!p(<nil>)>" }
|
||||
// a5: {"<%!p(attributes_test.key={})>": "<%!p(int=1)>" }
|
||||
// a6: {"<%!p(attributes_test.key={})>": "two" }
|
||||
// a7: {"<%!p(attributes_test.key={})>": "<%!p(attributes_test.stringVal={two})>" }
|
||||
// a8: {"<%!p(int=1)>": "<%!p(bool=true)>" }
|
||||
}
|
||||
|
||||
// Test that two attributes with the same content are Equal.
|
||||
|
|
Loading…
Reference in New Issue