Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
ca7e263a
Commit
ca7e263a
authored
Mar 27, 2018
by
hangaoshuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check error when json.Unmarshal failed
parent
f8134deb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
duration.go
staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/duration.go
+4
-1
micro_time.go
...ng/src/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go
+4
-1
No files found.
staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/duration.go
View file @
ca7e263a
...
@@ -31,7 +31,10 @@ type Duration struct {
...
@@ -31,7 +31,10 @@ type Duration struct {
// UnmarshalJSON implements the json.Unmarshaller interface.
// UnmarshalJSON implements the json.Unmarshaller interface.
func
(
d
*
Duration
)
UnmarshalJSON
(
b
[]
byte
)
error
{
func
(
d
*
Duration
)
UnmarshalJSON
(
b
[]
byte
)
error
{
var
str
string
var
str
string
json
.
Unmarshal
(
b
,
&
str
)
err
:=
json
.
Unmarshal
(
b
,
&
str
)
if
err
!=
nil
{
return
err
}
pd
,
err
:=
time
.
ParseDuration
(
str
)
pd
,
err
:=
time
.
ParseDuration
(
str
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go
View file @
ca7e263a
...
@@ -104,7 +104,10 @@ func (t *MicroTime) UnmarshalJSON(b []byte) error {
...
@@ -104,7 +104,10 @@ func (t *MicroTime) UnmarshalJSON(b []byte) error {
}
}
var
str
string
var
str
string
json
.
Unmarshal
(
b
,
&
str
)
err
:=
json
.
Unmarshal
(
b
,
&
str
)
if
err
!=
nil
{
return
err
}
pt
,
err
:=
time
.
Parse
(
RFC3339Micro
,
str
)
pt
,
err
:=
time
.
Parse
(
RFC3339Micro
,
str
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment