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
9f15368c
Unverified
Commit
9f15368c
authored
Mar 22, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Mar 22, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #75576 from smarterclayton/bad_2
Remove use of `%#v` in frequently accessed code
parents
29e74dc5
435db312
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
13 deletions
+11
-13
ref.go
pkg/kubelet/container/ref.go
+3
-5
helper.go
staging/src/k8s.io/apimachinery/pkg/runtime/helper.go
+3
-3
request.go
staging/src/k8s.io/client-go/rest/request.go
+4
-4
shared_informer.go
staging/src/k8s.io/client-go/tools/cache/shared_informer.go
+1
-1
No files found.
pkg/kubelet/container/ref.go
View file @
9f15368c
...
...
@@ -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
)
}
staging/src/k8s.io/apimachinery/pkg/runtime/helper.go
View file @
9f15368c
...
...
@@ -51,7 +51,7 @@ func UnsafeObjectConvertor(scheme *Scheme) ObjectConvertor {
func
SetField
(
src
interface
{},
v
reflect
.
Value
,
fieldName
string
)
error
{
field
:=
v
.
FieldByName
(
fieldName
)
if
!
field
.
IsValid
()
{
return
fmt
.
Errorf
(
"couldn't find %v field in %
#v
"
,
fieldName
,
v
.
Interface
())
return
fmt
.
Errorf
(
"couldn't find %v field in %
T
"
,
fieldName
,
v
.
Interface
())
}
srcValue
:=
reflect
.
ValueOf
(
src
)
if
srcValue
.
Type
()
.
AssignableTo
(
field
.
Type
())
{
...
...
@@ -70,7 +70,7 @@ func SetField(src interface{}, v reflect.Value, fieldName string) error {
func
Field
(
v
reflect
.
Value
,
fieldName
string
,
dest
interface
{})
error
{
field
:=
v
.
FieldByName
(
fieldName
)
if
!
field
.
IsValid
()
{
return
fmt
.
Errorf
(
"couldn't find %v field in %
#v
"
,
fieldName
,
v
.
Interface
())
return
fmt
.
Errorf
(
"couldn't find %v field in %
T
"
,
fieldName
,
v
.
Interface
())
}
destValue
,
err
:=
conversion
.
EnforcePtr
(
dest
)
if
err
!=
nil
{
...
...
@@ -93,7 +93,7 @@ func Field(v reflect.Value, fieldName string, dest interface{}) error {
func
FieldPtr
(
v
reflect
.
Value
,
fieldName
string
,
dest
interface
{})
error
{
field
:=
v
.
FieldByName
(
fieldName
)
if
!
field
.
IsValid
()
{
return
fmt
.
Errorf
(
"couldn't find %v field in %
#v
"
,
fieldName
,
v
.
Interface
())
return
fmt
.
Errorf
(
"couldn't find %v field in %
T
"
,
fieldName
,
v
.
Interface
())
}
v
,
err
:=
conversion
.
EnforcePtr
(
dest
)
if
err
!=
nil
{
...
...
staging/src/k8s.io/client-go/rest/request.go
View file @
9f15368c
...
...
@@ -592,7 +592,7 @@ func (r *Request) WatchWithSpecificDecoders(wrapperDecoderFn func(io.ReadCloser)
if
result
:=
r
.
transformResponse
(
resp
,
req
);
result
.
err
!=
nil
{
return
nil
,
result
.
err
}
return
nil
,
fmt
.
Errorf
(
"for request
'%+v'
, got status: %v"
,
url
,
resp
.
StatusCode
)
return
nil
,
fmt
.
Errorf
(
"for request
%s
, got status: %v"
,
url
,
resp
.
StatusCode
)
}
wrapperDecoder
:=
wrapperDecoderFn
(
resp
.
Body
)
return
watch
.
NewStreamWatcher
(
restclientwatch
.
NewDecoder
(
wrapperDecoder
,
embeddedDecoder
)),
nil
...
...
@@ -845,13 +845,13 @@ func (r *Request) transformResponse(resp *http.Response, req *http.Request) Resu
// 3. Apiserver closes connection.
// 4. client-go should catch this and return an error.
klog
.
V
(
2
)
.
Infof
(
"Stream error %#v when reading response body, may be caused by closed connection."
,
err
)
streamErr
:=
fmt
.
Errorf
(
"Stream error
%#v when reading response body, may be caused by closed connection. Please retry.
"
,
err
)
streamErr
:=
fmt
.
Errorf
(
"Stream error
when reading response body, may be caused by closed connection. Please retry. Original error: %v
"
,
err
)
return
Result
{
err
:
streamErr
,
}
default
:
klog
.
Errorf
(
"Unexpected error when reading response body: %
#
v"
,
err
)
unexpectedErr
:=
fmt
.
Errorf
(
"Unexpected error
%#v when reading response body. Please retry.
"
,
err
)
klog
.
Errorf
(
"Unexpected error when reading response body: %v"
,
err
)
unexpectedErr
:=
fmt
.
Errorf
(
"Unexpected error
when reading response body. Please retry. Original error: %v
"
,
err
)
return
Result
{
err
:
unexpectedErr
,
}
...
...
staging/src/k8s.io/client-go/tools/cache/shared_informer.go
View file @
9f15368c
...
...
@@ -555,7 +555,7 @@ func (p *processorListener) run() {
case
deleteNotification
:
p
.
handler
.
OnDelete
(
notification
.
oldObj
)
default
:
utilruntime
.
HandleError
(
fmt
.
Errorf
(
"unrecognized notification: %
#v
"
,
next
))
utilruntime
.
HandleError
(
fmt
.
Errorf
(
"unrecognized notification: %
T
"
,
next
))
}
}
// the only way to get here is if the p.nextCh is empty and closed
...
...
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