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
7cfb94cb
Commit
7cfb94cb
authored
Feb 11, 2018
by
hangaoshuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use SeekStart, SeekCurrent, and SeekEnd repalace of deprecated constant
parent
9d33926d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
logs.go
pkg/kubelet/kuberuntime/logs/logs.go
+2
-2
tail.go
pkg/util/tail/tail.go
+3
-3
No files found.
pkg/kubelet/kuberuntime/logs/logs.go
View file @
7cfb94cb
...
@@ -278,7 +278,7 @@ func ReadLogs(path, containerID string, opts *LogOptions, runtimeService interna
...
@@ -278,7 +278,7 @@ func ReadLogs(path, containerID string, opts *LogOptions, runtimeService interna
if
err
!=
nil
{
if
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to tail %d lines of log file %q: %v"
,
opts
.
tail
,
path
,
err
)
return
fmt
.
Errorf
(
"failed to tail %d lines of log file %q: %v"
,
opts
.
tail
,
path
,
err
)
}
}
if
_
,
err
:=
f
.
Seek
(
start
,
os
.
SEEK_SET
);
err
!=
nil
{
if
_
,
err
:=
f
.
Seek
(
start
,
io
.
SeekStart
);
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to seek %d in log file %q: %v"
,
start
,
path
,
err
)
return
fmt
.
Errorf
(
"failed to seek %d in log file %q: %v"
,
start
,
path
,
err
)
}
}
...
@@ -303,7 +303,7 @@ func ReadLogs(path, containerID string, opts *LogOptions, runtimeService interna
...
@@ -303,7 +303,7 @@ func ReadLogs(path, containerID string, opts *LogOptions, runtimeService interna
if
opts
.
follow
{
if
opts
.
follow
{
// Reset seek so that if this is an incomplete line,
// Reset seek so that if this is an incomplete line,
// it will be read again.
// it will be read again.
if
_
,
err
:=
f
.
Seek
(
-
int64
(
len
(
l
)),
os
.
SEEK_CUR
);
err
!=
nil
{
if
_
,
err
:=
f
.
Seek
(
-
int64
(
len
(
l
)),
io
.
SeekCurrent
);
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to reset seek in log file %q: %v"
,
path
,
err
)
return
fmt
.
Errorf
(
"failed to reset seek in log file %q: %v"
,
path
,
err
)
}
}
if
watcher
==
nil
{
if
watcher
==
nil
{
...
...
pkg/util/tail/tail.go
View file @
7cfb94cb
...
@@ -53,7 +53,7 @@ func ReadAtMost(path string, max int64) ([]byte, bool, error) {
...
@@ -53,7 +53,7 @@ func ReadAtMost(path string, max int64) ([]byte, bool, error) {
if
size
<
max
{
if
size
<
max
{
max
=
size
max
=
size
}
}
offset
,
err
:=
f
.
Seek
(
-
max
,
os
.
SEEK_END
)
offset
,
err
:=
f
.
Seek
(
-
max
,
io
.
SeekEnd
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
false
,
err
return
nil
,
false
,
err
}
}
...
@@ -70,7 +70,7 @@ func FindTailLineStartIndex(f io.ReadSeeker, n int64) (int64, error) {
...
@@ -70,7 +70,7 @@ func FindTailLineStartIndex(f io.ReadSeeker, n int64) (int64, error) {
if
n
<
0
{
if
n
<
0
{
return
0
,
nil
return
0
,
nil
}
}
size
,
err
:=
f
.
Seek
(
0
,
os
.
SEEK_END
)
size
,
err
:=
f
.
Seek
(
0
,
io
.
SeekEnd
)
if
err
!=
nil
{
if
err
!=
nil
{
return
0
,
err
return
0
,
err
}
}
...
@@ -82,7 +82,7 @@ func FindTailLineStartIndex(f io.ReadSeeker, n int64) (int64, error) {
...
@@ -82,7 +82,7 @@ func FindTailLineStartIndex(f io.ReadSeeker, n int64) (int64, error) {
left
=
0
left
=
0
buf
=
make
([]
byte
,
right
)
buf
=
make
([]
byte
,
right
)
}
}
if
_
,
err
:=
f
.
Seek
(
left
,
os
.
SEEK_SET
);
err
!=
nil
{
if
_
,
err
:=
f
.
Seek
(
left
,
io
.
SeekStart
);
err
!=
nil
{
return
0
,
err
return
0
,
err
}
}
if
_
,
err
:=
f
.
Read
(
buf
);
err
!=
nil
{
if
_
,
err
:=
f
.
Read
(
buf
);
err
!=
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