diff --git a/attributes/attributes.go b/attributes/attributes.go index 16475b6af1fc..52d530d7ad01 100644 --- a/attributes/attributes.go +++ b/attributes/attributes.go @@ -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 diff --git a/attributes/attributes_test.go b/attributes/attributes_test.go index 3b8a0717f73a..4cbdf07094a8 100644 --- a/attributes/attributes_test.go +++ b/attributes/attributes_test.go @@ -85,14 +85,14 @@ func ExampleAttributes_String() { fmt.Println("a7:", a7.String()) fmt.Println("a8:", a8.String()) // Output: - // a1: {"attributes_test.key{}": "" } - // a2: {"attributes_test.key{}": "" } - // a3: {"attributes_test.key{}": "(*attributes_test.stringVal)(nil)" } - // a4: {"attributes_test.key{}": "" } - // 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={})>": "" } + // a2: {"<%!p(attributes_test.key={})>": "" } + // a3: {"<%!p(attributes_test.key={})>": "<0x0>" } + // a4: {"<%!p(attributes_test.key={})>": "<%!p()>" } + // 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.