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
ce4c793b
Commit
ce4c793b
authored
May 25, 2017
by
zhengjiajin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix err message and small change in UX
parent
ee0de5f3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
5 deletions
+3
-5
codec_check.go
staging/src/k8s.io/apimachinery/pkg/runtime/codec_check.go
+3
-5
No files found.
staging/src/k8s.io/apimachinery/pkg/runtime/codec_check.go
View file @
ce4c793b
...
@@ -28,8 +28,7 @@ import (
...
@@ -28,8 +28,7 @@ import (
// object. (Will modify internalObject.) (Assumes JSON serialization.)
// object. (Will modify internalObject.) (Assumes JSON serialization.)
// TODO: verify that the correct external version is chosen on encode...
// TODO: verify that the correct external version is chosen on encode...
func
CheckCodec
(
c
Codec
,
internalType
Object
,
externalTypes
...
schema
.
GroupVersionKind
)
error
{
func
CheckCodec
(
c
Codec
,
internalType
Object
,
externalTypes
...
schema
.
GroupVersionKind
)
error
{
_
,
err
:=
Encode
(
c
,
internalType
)
if
_
,
err
:=
Encode
(
c
,
internalType
);
err
!=
nil
{
if
err
!=
nil
{
return
fmt
.
Errorf
(
"Internal type not encodable: %v"
,
err
)
return
fmt
.
Errorf
(
"Internal type not encodable: %v"
,
err
)
}
}
for
_
,
et
:=
range
externalTypes
{
for
_
,
et
:=
range
externalTypes
{
...
@@ -41,9 +40,8 @@ func CheckCodec(c Codec, internalType Object, externalTypes ...schema.GroupVersi
...
@@ -41,9 +40,8 @@ func CheckCodec(c Codec, internalType Object, externalTypes ...schema.GroupVersi
if
reflect
.
TypeOf
(
obj
)
!=
reflect
.
TypeOf
(
internalType
)
{
if
reflect
.
TypeOf
(
obj
)
!=
reflect
.
TypeOf
(
internalType
)
{
return
fmt
.
Errorf
(
"decode of external type %s produced: %#v"
,
et
,
obj
)
return
fmt
.
Errorf
(
"decode of external type %s produced: %#v"
,
et
,
obj
)
}
}
err
=
DecodeInto
(
c
,
exBytes
,
internalType
)
if
err
=
DecodeInto
(
c
,
exBytes
,
internalType
);
err
!=
nil
{
if
err
!=
nil
{
return
fmt
.
Errorf
(
"external type %s not convertible to internal type: %v"
,
et
,
err
)
return
fmt
.
Errorf
(
"external type %s not convertable to internal type: %v"
,
et
,
err
)
}
}
}
}
return
nil
return
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