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
6050f59b
Commit
6050f59b
authored
Feb 21, 2017
by
Dr. Stefan Schimanski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
apimachinery: merge Scheme.AddKnownTypes and Scheme.AddKnownTypeWithName
parent
6d9e2afe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
10 deletions
+1
-10
scheme.go
staging/src/k8s.io/apimachinery/pkg/runtime/scheme.go
+1
-10
No files found.
staging/src/k8s.io/apimachinery/pkg/runtime/scheme.go
View file @
6050f59b
...
...
@@ -163,22 +163,13 @@ func (s *Scheme) AddUnversionedTypes(version schema.GroupVersion, types ...Objec
// the struct becomes the "kind" field when encoding. Version may not be empty - use the
// APIVersionInternal constant if you have a type that does not have a formal version.
func
(
s
*
Scheme
)
AddKnownTypes
(
gv
schema
.
GroupVersion
,
types
...
Object
)
{
if
len
(
gv
.
Version
)
==
0
{
panic
(
fmt
.
Sprintf
(
"version is required on all types: %s %v"
,
gv
,
types
[
0
]))
}
for
_
,
obj
:=
range
types
{
t
:=
reflect
.
TypeOf
(
obj
)
if
t
.
Kind
()
!=
reflect
.
Ptr
{
panic
(
"All types must be pointers to structs."
)
}
t
=
t
.
Elem
()
if
t
.
Kind
()
!=
reflect
.
Struct
{
panic
(
"All types must be pointers to structs."
)
}
gvk
:=
gv
.
WithKind
(
t
.
Name
())
s
.
gvkToType
[
gvk
]
=
t
s
.
typeToGVK
[
t
]
=
append
(
s
.
typeToGVK
[
t
],
gvk
)
s
.
AddKnownTypeWithName
(
gv
.
WithKind
(
t
.
Name
()),
obj
)
}
}
...
...
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