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
d12a66a4
Commit
d12a66a4
authored
Aug 17, 2016
by
Kara Alexandra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename IsEmpty to Empty
Signed-off-by:
Kara Alexandra
<
kalexandra@us.ibm.com
>
parent
5f7875a9
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
23 additions
and
23 deletions
+23
-23
errors.go
pkg/api/errors/errors.go
+2
-2
restmapper.go
pkg/api/meta/restmapper.go
+2
-2
group_version.go
pkg/api/unversioned/group_version.go
+8
-8
api_installer.go
pkg/apiserver/api_installer.go
+1
-1
discovery_client.go
pkg/client/typed/discovery/discovery_client.go
+1
-1
explain.go
pkg/kubectl/cmd/explain.go
+1
-1
factory.go
pkg/kubectl/cmd/util/factory.go
+2
-2
builder.go
pkg/kubectl/resource/builder.go
+1
-1
result.go
pkg/kubectl/resource/result.go
+2
-2
visitor.go
pkg/kubectl/resource/visitor.go
+1
-1
codec.go
pkg/registry/thirdpartyresourcedata/codec.go
+1
-1
unstructured.go
pkg/runtime/unstructured.go
+1
-1
No files found.
pkg/api/errors/errors.go
View file @
d12a66a4
...
...
@@ -329,9 +329,9 @@ func NewGenericServerResponse(code int, verb string, qualifiedResource unversion
}
}
switch
{
case
!
qualifiedResource
.
Is
Empty
()
&&
len
(
name
)
>
0
:
case
!
qualifiedResource
.
Empty
()
&&
len
(
name
)
>
0
:
message
=
fmt
.
Sprintf
(
"%s (%s %s %s)"
,
message
,
strings
.
ToLower
(
verb
),
qualifiedResource
.
String
(),
name
)
case
!
qualifiedResource
.
Is
Empty
()
:
case
!
qualifiedResource
.
Empty
()
:
message
=
fmt
.
Sprintf
(
"%s (%s %s)"
,
message
,
strings
.
ToLower
(
verb
),
qualifiedResource
.
String
())
}
var
causes
[]
unversioned
.
StatusCause
...
...
pkg/api/meta/restmapper.go
View file @
d12a66a4
...
...
@@ -183,7 +183,7 @@ func (m *DefaultRESTMapper) ResourceSingularizer(resourceType string) (string, e
if
!
ok
{
continue
}
if
singular
.
Is
Empty
()
{
if
singular
.
Empty
()
{
singular
=
currSingular
continue
}
...
...
@@ -193,7 +193,7 @@ func (m *DefaultRESTMapper) ResourceSingularizer(resourceType string) (string, e
}
}
if
singular
.
Is
Empty
()
{
if
singular
.
Empty
()
{
return
resourceType
,
fmt
.
Errorf
(
"no singular of resource %v has been defined"
,
resourceType
)
}
...
...
pkg/api/unversioned/group_version.go
View file @
d12a66a4
...
...
@@ -50,7 +50,7 @@ func (gr GroupResource) WithVersion(version string) GroupVersionResource {
return
GroupVersionResource
{
Group
:
gr
.
Group
,
Version
:
version
,
Resource
:
gr
.
Resource
}
}
func
(
gr
GroupResource
)
Is
Empty
()
bool
{
func
(
gr
GroupResource
)
Empty
()
bool
{
return
len
(
gr
.
Group
)
==
0
&&
len
(
gr
.
Resource
)
==
0
}
...
...
@@ -81,7 +81,7 @@ type GroupVersionResource struct {
Resource
string
`protobuf:"bytes,3,opt,name=resource"`
}
func
(
gvr
GroupVersionResource
)
Is
Empty
()
bool
{
func
(
gvr
GroupVersionResource
)
Empty
()
bool
{
return
len
(
gvr
.
Group
)
==
0
&&
len
(
gvr
.
Version
)
==
0
&&
len
(
gvr
.
Resource
)
==
0
}
...
...
@@ -106,7 +106,7 @@ type GroupKind struct {
Kind
string
`protobuf:"bytes,2,opt,name=kind"`
}
func
(
gk
GroupKind
)
Is
Empty
()
bool
{
func
(
gk
GroupKind
)
Empty
()
bool
{
return
len
(
gk
.
Group
)
==
0
&&
len
(
gk
.
Kind
)
==
0
}
...
...
@@ -131,8 +131,8 @@ type GroupVersionKind struct {
Kind
string
`protobuf:"bytes,3,opt,name=kind"`
}
//
Is
Empty returns true if group, version, and kind are empty
func
(
gvk
GroupVersionKind
)
Is
Empty
()
bool
{
// Empty returns true if group, version, and kind are empty
func
(
gvk
GroupVersionKind
)
Empty
()
bool
{
return
len
(
gvk
.
Group
)
==
0
&&
len
(
gvk
.
Version
)
==
0
&&
len
(
gvk
.
Kind
)
==
0
}
...
...
@@ -156,8 +156,8 @@ type GroupVersion struct {
Version
string
`protobuf:"bytes,2,opt,name=version"`
}
//
Is
Empty returns true if group and version are empty
func
(
gv
GroupVersion
)
Is
Empty
()
bool
{
// Empty returns true if group and version are empty
func
(
gv
GroupVersion
)
Empty
()
bool
{
return
len
(
gv
.
Group
)
==
0
&&
len
(
gv
.
Version
)
==
0
}
...
...
@@ -165,7 +165,7 @@ func (gv GroupVersion) IsEmpty() bool {
// it returns "v1".
func
(
gv
GroupVersion
)
String
()
string
{
// special case the internal apiVersion for the legacy kube types
if
gv
.
Is
Empty
()
{
if
gv
.
Empty
()
{
return
""
}
...
...
pkg/apiserver/api_installer.go
View file @
d12a66a4
...
...
@@ -137,7 +137,7 @@ func (a *APIInstaller) getResourceKind(path string, storage rest.Storage) (unver
fqKindToRegister
=
a
.
group
.
GroupVersion
.
WithKind
(
fqKind
.
Kind
)
}
}
if
fqKindToRegister
.
Is
Empty
()
{
if
fqKindToRegister
.
Empty
()
{
return
unversioned
.
GroupVersionKind
{},
fmt
.
Errorf
(
"unable to locate fully qualified kind for %v: found %v when registering for %v"
,
reflect
.
TypeOf
(
object
),
fqKinds
,
a
.
group
.
GroupVersion
)
}
return
fqKindToRegister
,
nil
...
...
pkg/client/typed/discovery/discovery_client.go
View file @
d12a66a4
...
...
@@ -234,7 +234,7 @@ func (d *DiscoveryClient) ServerVersion() (*version.Info, error) {
// SwaggerSchema retrieves and parses the swagger API schema the server supports.
func
(
d
*
DiscoveryClient
)
SwaggerSchema
(
version
unversioned
.
GroupVersion
)
(
*
swagger
.
ApiDeclaration
,
error
)
{
if
version
.
Is
Empty
()
{
if
version
.
Empty
()
{
return
nil
,
fmt
.
Errorf
(
"groupVersion cannot be empty"
)
}
...
...
pkg/kubectl/cmd/explain.go
View file @
d12a66a4
...
...
@@ -84,7 +84,7 @@ func RunExplain(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []st
if
fullySpecifiedGVR
!=
nil
{
gvk
,
_
=
mapper
.
KindFor
(
*
fullySpecifiedGVR
)
}
if
gvk
.
Is
Empty
()
{
if
gvk
.
Empty
()
{
gvk
,
err
=
mapper
.
KindFor
(
groupResource
.
WithVersion
(
""
))
if
err
!=
nil
{
return
err
...
...
pkg/kubectl/cmd/util/factory.go
View file @
d12a66a4
...
...
@@ -1270,10 +1270,10 @@ func (f *Factory) PrinterForMapping(cmd *cobra.Command, mapping *meta.RESTMappin
if
err
!=
nil
{
return
nil
,
err
}
if
version
.
Is
Empty
()
&&
mapping
!=
nil
{
if
version
.
Empty
()
&&
mapping
!=
nil
{
version
=
mapping
.
GroupVersionKind
.
GroupVersion
()
}
if
version
.
Is
Empty
()
{
if
version
.
Empty
()
{
return
nil
,
fmt
.
Errorf
(
"you must specify an output-version when using this output format"
)
}
...
...
pkg/kubectl/resource/builder.go
View file @
d12a66a4
...
...
@@ -454,7 +454,7 @@ func (b *Builder) mappingFor(resourceArg string) (*meta.RESTMapping, error) {
if
fullySpecifiedGVR
!=
nil
{
gvk
,
_
=
b
.
mapper
.
KindFor
(
*
fullySpecifiedGVR
)
}
if
gvk
.
Is
Empty
()
{
if
gvk
.
Empty
()
{
var
err
error
gvk
,
err
=
b
.
mapper
.
KindFor
(
groupResource
.
WithVersion
(
""
))
if
err
!=
nil
{
...
...
pkg/kubectl/resource/result.go
View file @
d12a66a4
...
...
@@ -250,7 +250,7 @@ func AsVersionedObjects(infos []*Info, version unversioned.GroupVersion, encoder
// objects that are not part of api.Scheme must be converted to JSON
// TODO: convert to map[string]interface{}, attach to runtime.Unknown?
if
!
version
.
Is
Empty
()
{
if
!
version
.
Empty
()
{
if
_
,
_
,
err
:=
api
.
Scheme
.
ObjectKinds
(
info
.
Object
);
runtime
.
IsNotRegisteredError
(
err
)
{
// TODO: ideally this would encode to version, but we don't expose multiple codecs here.
data
,
err
:=
runtime
.
Encode
(
encoder
,
info
.
Object
)
...
...
@@ -277,7 +277,7 @@ func AsVersionedObjects(infos []*Info, version unversioned.GroupVersion, encoder
func
tryConvert
(
converter
runtime
.
ObjectConvertor
,
object
runtime
.
Object
,
versions
...
unversioned
.
GroupVersion
)
(
runtime
.
Object
,
error
)
{
var
last
error
for
_
,
version
:=
range
versions
{
if
version
.
Is
Empty
()
{
if
version
.
Empty
()
{
return
object
,
nil
}
obj
,
err
:=
converter
.
ConvertToVersion
(
object
,
version
)
...
...
pkg/kubectl/resource/visitor.go
View file @
d12a66a4
...
...
@@ -385,7 +385,7 @@ func (v FlattenListVisitor) Visit(fn VisitorFunc) error {
// If we have a GroupVersionKind on the list, prioritize that when asking for info on the objects contained in the list
var
preferredGVKs
[]
unversioned
.
GroupVersionKind
if
info
.
Mapping
!=
nil
&&
!
info
.
Mapping
.
GroupVersionKind
.
Is
Empty
()
{
if
info
.
Mapping
!=
nil
&&
!
info
.
Mapping
.
GroupVersionKind
.
Empty
()
{
preferredGVKs
=
append
(
preferredGVKs
,
info
.
Mapping
.
GroupVersionKind
)
}
...
...
pkg/registry/thirdpartyresourcedata/codec.go
View file @
d12a66a4
...
...
@@ -517,7 +517,7 @@ func (t *thirdPartyResourceDataEncoder) Encode(obj runtime.Object, stream io.Wri
listItems
[
ix
]
=
json
.
RawMessage
(
buff
.
Bytes
())
}
if
t
.
gvk
.
Is
Empty
()
{
if
t
.
gvk
.
Empty
()
{
return
fmt
.
Errorf
(
"thirdPartyResourceDataEncoder was not given a target version"
)
}
...
...
pkg/runtime/unstructured.go
View file @
d12a66a4
...
...
@@ -188,7 +188,7 @@ func (UnstructuredObjectConverter) Convert(in, out, context interface{}) error {
}
func
(
UnstructuredObjectConverter
)
ConvertToVersion
(
in
Object
,
target
GroupVersioner
)
(
Object
,
error
)
{
if
kind
:=
in
.
GetObjectKind
()
.
GroupVersionKind
();
!
kind
.
Is
Empty
()
{
if
kind
:=
in
.
GetObjectKind
()
.
GroupVersionKind
();
!
kind
.
Empty
()
{
gvk
,
ok
:=
target
.
KindForGroupVersionKinds
([]
unversioned
.
GroupVersionKind
{
kind
})
if
!
ok
{
// TODO: should this be a typed error?
...
...
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