Skip to content

Commit 9365a1b

Browse files
committed
Fix golangci-lint errors
Signed-off-by: Phil Estes <[email protected]>
1 parent f1c9af8 commit 9365a1b

18 files changed

Lines changed: 29 additions & 30 deletions

commands/ls.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ var LSCmd = &cobra.Command{
4444
for _, entry := range bm.Resource {
4545
for _, path := range entry.Path {
4646
if os.FileMode(entry.Mode)&os.ModeSymlink != 0 {
47+
//nolint:unconvert
4748
fmt.Fprintf(w, "%v\t%v\t%v\t%v\t%v -> %v\n", os.FileMode(entry.Mode), entry.User, entry.Group, humanize.Bytes(uint64(entry.Size)), path, entry.Target)
4849
} else {
50+
//nolint:unconvert
4951
fmt.Fprintf(w, "%v\t%v\t%v\t%v\t%v\n", os.FileMode(entry.Mode), entry.User, entry.Group, humanize.Bytes(uint64(entry.Size)), path)
5052
}
5153

context.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ func (c *context) Walk(fn filepath.WalkFunc) error {
596596
return err
597597
}
598598
}
599-
return c.pathDriver.Walk(root, func(p string, fi os.FileInfo, err error) error {
599+
return c.pathDriver.Walk(root, func(p string, fi os.FileInfo, _ error) error {
600600
contained, err := c.containWithRoot(p, root)
601601
return fn(contained, fi, err)
602602
})
@@ -613,12 +613,6 @@ func (c *context) fullpath(p string) (string, error) {
613613
return p, nil
614614
}
615615

616-
// contain cleans and santizes the filesystem path p to be an absolute path,
617-
// effectively relative to the context root.
618-
func (c *context) contain(p string) (string, error) {
619-
return c.containWithRoot(p, c.root)
620-
}
621-
622616
// containWithRoot cleans and santizes the filesystem path p to be an absolute path,
623617
// effectively relative to the passed root. Extra care should be used when calling this
624618
// instead of contain. This is needed for Walk, as if context root is a symlink,

continuityfs/fuse.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ type fileHandler struct {
131131
func (h *fileHandler) Read(ctx context.Context, req *fuse.ReadRequest, resp *fuse.ReadResponse) error {
132132
if h.offset != req.Offset {
133133
if seeker, ok := h.reader.(io.Seeker); ok {
134-
if _, err := seeker.Seek(req.Offset, os.SEEK_SET); err != nil {
134+
if _, err := seeker.Seek(req.Offset, io.SeekStart); err != nil {
135135
logrus.Debugf("Error seeking: %v", err)
136136
return err
137137
}

devices/devices_unix.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ func DeviceInfo(fi os.FileInfo) (uint64, uint64, error) {
3232
return 0, 0, fmt.Errorf("cannot extract device from os.FileInfo")
3333
}
3434

35+
//nolint:unconvert
3536
dev := uint64(sys.Rdev)
3637
return uint64(unix.Major(dev)), uint64(unix.Minor(dev)), nil
3738
}

digests.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,9 @@ func digestsMatch(as, bs []digest.Digest) bool {
8888
}
8989

9090
disjoint := len(as) + len(bs)
91-
if len(uniqified) == disjoint {
92-
// if these two sets have the same cardinality, we know both sides
93-
// didn't share any digests.
94-
return false
95-
}
96-
97-
return true
91+
// if these two sets have the same cardinality, we know both sides
92+
// didn't share any digests.
93+
return len(uniqified) != disjoint
9894
}
9995

10096
type digestSlice []digest.Digest

driver/driver_windows.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// +build go1.13
2+
13
/*
24
Copyright The containerd Authors.
35
@@ -14,8 +16,6 @@
1416
limitations under the License.
1517
*/
1618

17-
// +build go1.13
18-
1919
// Go 1.13 is the minimally supported version for Windows.
2020
// Earlier golang releases have bug in os.Readlink
2121
// (see https://github.com/golang/go/issues/30463).

fs/fstest/continuity_util.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func (l resourceListDifference) HasDiff() bool {
4747
}
4848

4949
for _, add := range l.Additions {
50-
if ok, _ := metadataFiles[add.Path()]; !ok {
50+
if ok := metadataFiles[add.Path()]; !ok {
5151
return true
5252
}
5353
}
@@ -66,7 +66,7 @@ func (l resourceListDifference) String() string {
6666
for _, upt := range l.Updates {
6767
fmt.Fprintf(buf, "~ %s\n", upt.String())
6868
}
69-
return string(buf.Bytes())
69+
return buf.String()
7070
}
7171

7272
// diffManifest compares two resource lists and returns the list

fs/fstest/testsuite.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ var (
210210
}
211211

212212
// Hardlink name before with modification
213-
// Tests link is created for unmodified files when new hardlinked file is seen first
213+
// Tests link is created for unmodified files when a new hard linked file is seen first
214214
hardlinkBeforeUnmodified = []Applier{
215215
baseApplier,
216216
Apply(

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/containerd/continuity
22

3-
go 1.11
3+
go 1.13
44

55
require (
66
bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898

groups_unix.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
limitations under the License.
1515
*/
1616

17+
//nolint:unused,deadcode
1718
package continuity
1819

1920
import (

0 commit comments

Comments
 (0)