File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
staging/src/k8s.io/apimachinery/pkg/apis/meta/v1 Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ import (
20
20
"encoding/json"
21
21
"time"
22
22
23
- "github.com/google/gofuzz"
23
+ fuzz "github.com/google/gofuzz"
24
24
)
25
25
26
26
// Time is a wrapper around time.Time which supports correct
@@ -147,8 +147,12 @@ func (t Time) MarshalJSON() ([]byte, error) {
147
147
// Encode unset/nil objects as JSON's "null".
148
148
return []byte ("null" ), nil
149
149
}
150
-
151
- return json .Marshal (t .UTC ().Format (time .RFC3339 ))
150
+ buf := make ([]byte , 0 , len (time .RFC3339 )+ 2 )
151
+ buf = append (buf , '"' )
152
+ // time cannot contain non escapable JSON characters
153
+ buf = t .UTC ().AppendFormat (buf , time .RFC3339 )
154
+ buf = append (buf , '"' )
155
+ return buf , nil
152
156
}
153
157
154
158
// OpenAPISchemaType is used by the kube-openapi generator when constructing
You can’t perform that action at this time.
0 commit comments