mirror of https://github.com/k3s-io/k3s
Merge pull request #61757 from hanxiaoshuai/bugfix0327
Automatic merge from submit-queue (batch tested with PRs 61790, 61808, 60339, 61615, 61757). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. check error when json.Unmarshal failed **What this PR does / why we need it**: check error when json.Unmarshal failed **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes # **Special notes for your reviewer**: **Release note**: ```release-note NONE ```pull/8/head
commit
27df7d184b
|
@ -31,7 +31,10 @@ type Duration struct {
|
|||
// UnmarshalJSON implements the json.Unmarshaller interface.
|
||||
func (d *Duration) UnmarshalJSON(b []byte) error {
|
||||
var str string
|
||||
json.Unmarshal(b, &str)
|
||||
err := json.Unmarshal(b, &str)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
pd, err := time.ParseDuration(str)
|
||||
if err != nil {
|
||||
|
|
|
@ -104,7 +104,10 @@ func (t *MicroTime) UnmarshalJSON(b []byte) error {
|
|||
}
|
||||
|
||||
var str string
|
||||
json.Unmarshal(b, &str)
|
||||
err := json.Unmarshal(b, &str)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
pt, err := time.Parse(RFC3339Micro, str)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue