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
b28e82ad
Unverified
Commit
b28e82ad
authored
Mar 21, 2019
by
Clayton Coleman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid using `%#v` for errors when using only a portion of the object
`%#v` may have significant performance costs in frequently invoked code.
parent
d29afda3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
5 deletions
+3
-5
ref.go
pkg/kubelet/container/ref.go
+3
-5
No files found.
pkg/kubelet/container/ref.go
View file @
b28e82ad
...
...
@@ -54,9 +54,8 @@ func fieldPath(pod *v1.Pod, container *v1.Container) (string, error) {
if
here
.
Name
==
container
.
Name
{
if
here
.
Name
==
""
{
return
fmt
.
Sprintf
(
"spec.containers[%d]"
,
i
),
nil
}
else
{
return
fmt
.
Sprintf
(
"spec.containers{%s}"
,
here
.
Name
),
nil
}
return
fmt
.
Sprintf
(
"spec.containers{%s}"
,
here
.
Name
),
nil
}
}
for
i
:=
range
pod
.
Spec
.
InitContainers
{
...
...
@@ -64,10 +63,9 @@ func fieldPath(pod *v1.Pod, container *v1.Container) (string, error) {
if
here
.
Name
==
container
.
Name
{
if
here
.
Name
==
""
{
return
fmt
.
Sprintf
(
"spec.initContainers[%d]"
,
i
),
nil
}
else
{
return
fmt
.
Sprintf
(
"spec.initContainers{%s}"
,
here
.
Name
),
nil
}
return
fmt
.
Sprintf
(
"spec.initContainers{%s}"
,
here
.
Name
),
nil
}
}
return
""
,
fmt
.
Errorf
(
"container %
#v not found in pod %#v"
,
container
,
pod
)
return
""
,
fmt
.
Errorf
(
"container %
q not found in pod %s/%s"
,
container
.
Name
,
pod
.
Namespace
,
pod
.
Name
)
}
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