File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ func Stringify(message interface{}) string {
27
27
28
28
func stringifyValue (w * bytes.Buffer , val reflect.Value ) {
29
29
if val .Kind () == reflect .Ptr && val .IsNil () {
30
- w .Write ([] byte ( "<nil>" ) )
30
+ w .WriteString ( "<nil>" )
31
31
return
32
32
}
33
33
@@ -37,20 +37,20 @@ func stringifyValue(w *bytes.Buffer, val reflect.Value) {
37
37
case reflect .String :
38
38
fmt .Fprintf (w , `"%s"` , v )
39
39
case reflect .Slice :
40
- w .Write ([] byte { '[' } )
40
+ w .WriteByte ( '[' )
41
41
for i := 0 ; i < v .Len (); i ++ {
42
42
if i > 0 {
43
- w .Write ([] byte { ' ' } )
43
+ w .WriteByte ( ' ' )
44
44
}
45
45
46
46
stringifyValue (w , v .Index (i ))
47
47
}
48
48
49
- w .Write ([] byte { ']' } )
49
+ w .WriteByte ( ']' )
50
50
return
51
51
case reflect .Struct :
52
52
if v .Type ().Name () != "" {
53
- w .Write ([] byte ( v .Type ().String () ))
53
+ w .WriteString ( v .Type ().String ())
54
54
}
55
55
56
56
// special handling of Timestamp values
@@ -59,7 +59,7 @@ func stringifyValue(w *bytes.Buffer, val reflect.Value) {
59
59
return
60
60
}
61
61
62
- w .Write ([] byte { '{' } )
62
+ w .WriteByte ( '{' )
63
63
64
64
var sep bool
65
65
for i := 0 ; i < v .NumField (); i ++ {
@@ -75,17 +75,17 @@ func stringifyValue(w *bytes.Buffer, val reflect.Value) {
75
75
}
76
76
77
77
if sep {
78
- w .Write ([] byte ( ", " ) )
78
+ w .WriteString ( ", " )
79
79
} else {
80
80
sep = true
81
81
}
82
82
83
- w .Write ([] byte ( v .Type ().Field (i ).Name ) )
84
- w .Write ([] byte { ':' } )
83
+ w .WriteString ( v .Type ().Field (i ).Name )
84
+ w .WriteByte ( ':' )
85
85
stringifyValue (w , fv )
86
86
}
87
87
88
- w .Write ([] byte { '}' } )
88
+ w .WriteByte ( '}' )
89
89
default :
90
90
if v .CanInterface () {
91
91
fmt .Fprint (w , v .Interface ())
You can’t perform that action at this time.
0 commit comments