File tree Expand file tree Collapse file tree 1 file changed +1
-17
lines changed Expand file tree Collapse file tree 1 file changed +1
-17
lines changed Original file line number Diff line number Diff line change @@ -125,26 +125,10 @@ func (a *Attributes) String() string {
125125const nilAngleString = "<nil>"
126126
127127func str (x any ) (s string ) {
128- defer func () {
129- if r := recover (); r != nil {
130- // If it panics with a nil pointer, just say "<nil>". The likeliest causes are a
131- // [fmt.Stringer] that fails to guard against nil or a nil pointer for a
132- // value receiver, and in either case, "<nil>" is a nice result.
133- //
134- // Adapted from the code in fmt/print.go.
135- if v := reflect .ValueOf (x ); v .Kind () == reflect .Pointer && v .IsNil () {
136- s = nilAngleString
137- return
138- }
139-
140- // The panic was likely not caused by fmt.Stringer.
141- panic (r )
142- }
143- }()
144128 if x == nil { // NOTE: typed nils will not be caught by this check
145129 return nilAngleString
146130 } else if v , ok := x .(fmt.Stringer ); ok {
147- return v . String ( )
131+ return fmt . Sprint ( v )
148132 } else if v , ok := x .(string ); ok {
149133 return v
150134 }
You can’t perform that action at this time.
0 commit comments