Skip to content

Commit 2c1c223

Browse files
committed
Fix lint warning
Signed-off-by: Lei Jitang <[email protected]>
1 parent a8bafa4 commit 2c1c223

File tree

3 files changed

+8
-20
lines changed

3 files changed

+8
-20
lines changed

image/change.go

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,6 @@ func (c changesByPath) Less(i, j int) bool { return c[i].Path < c[j].Path }
5858
func (c changesByPath) Len() int { return len(c) }
5959
func (c changesByPath) Swap(i, j int) { c[j], c[i] = c[i], c[j] }
6060

61-
// Gnu tar and the go tar writer don't have sub-second mtime
62-
// precision, which is problematic when we apply changes via tar
63-
// files, we handle this by comparing for exact times, *or* same
64-
// second count and either a or b having exactly 0 nanoseconds
65-
func sameFsTime(a, b time.Time) bool {
66-
return a == b ||
67-
(a.Unix() == b.Unix() &&
68-
(a.Nanosecond() == 0 || b.Nanosecond() == 0))
69-
}
70-
7161
func sameFsTimeSpec(a, b syscall.Timespec) bool {
7262
return a.Sec == b.Sec &&
7363
(a.Nsec == b.Nsec || a.Nsec == 0 || b.Nsec == 0)
@@ -218,7 +208,12 @@ func ChangesDirs(newDir, oldDir string) ([]Change, error) {
218208
if err != nil {
219209
return nil, err
220210
}
221-
defer os.Remove(emptyDir)
211+
defer func() {
212+
err := os.Remove(emptyDir)
213+
if err != nil {
214+
logrus.Debugf("failed to remove tmp dir: %v", err)
215+
}
216+
}()
222217
oldDir = emptyDir
223218
}
224219
oldRoot, newRoot, err := collectFileInfoForChanges(oldDir, newDir)

image/change_unix.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func walkchunk(path string, fi os.FileInfo, dir string, root *FileInfo) error {
9999

100100
// Walk a subtree rooted at the same path in both trees being iterated. For
101101
// example, /oci/overlay/1234/a/b/c/d and /oci/overlay/8888/a/b/c/d
102-
func (w *filewalker) walk(path string, i1, i2 os.FileInfo) (err error) {
102+
func (w *filewalker) walk(path string, i1, i2 os.FileInfo) (retErr error) {
103103
// Register these nodes with the return trees, unless we're still at the
104104
// (already-created) roots:
105105
if path != "/" {
@@ -315,11 +315,3 @@ func statDifferent(oldStat *utils.StatT, newStat *utils.StatT) bool {
315315
func (info *FileInfo) isDir() bool {
316316
return info.parent == nil || info.stat.Mode()&syscall.S_IFDIR != 0
317317
}
318-
319-
func getIno(fi os.FileInfo) uint64 {
320-
return uint64(fi.Sys().(*syscall.Stat_t).Ino)
321-
}
322-
323-
func hasHardlinks(fi os.FileInfo) bool {
324-
return fi.Sys().(*syscall.Stat_t).Nlink > 1
325-
}

image/layer.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"path/filepath"
2222
)
2323

24+
// CreateLayer create layer from filesystem changeset
2425
func CreateLayer(child, parent, dest string) error {
2526
arch, err := Diff(child, parent)
2627
if err != nil {

0 commit comments

Comments
 (0)