From e1ccf08642e76604767c4c26d180abadc73b6552 Mon Sep 17 00:00:00 2001 From: Austin Vazquez Date: Wed, 20 Nov 2024 21:04:22 -0700 Subject: [PATCH 1/2] Rename arguments to not mask built-in functions Signed-off-by: Austin Vazquez --- devices/devices_unix.go | 4 ++-- driver/driver.go | 2 +- driver/driver_unix.go | 2 +- fs/diff_linux.go | 4 ++-- fs/fstest/file.go | 4 ++-- fs/fstest/file_unix.go | 4 ++-- fs/fstest/file_windows.go | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/devices/devices_unix.go b/devices/devices_unix.go index 451979b7..741cf47e 100644 --- a/devices/devices_unix.go +++ b/devices/devices_unix.go @@ -38,14 +38,14 @@ func DeviceInfo(fi os.FileInfo) (uint64, uint64, error) { } // mknod provides a shortcut for syscall.Mknod -func Mknod(p string, mode os.FileMode, maj, min int) error { +func Mknod(p string, mode os.FileMode, major, minor int) error { var ( m = syscallMode(mode.Perm()) dev uint64 ) if mode&os.ModeDevice != 0 { - dev = unix.Mkdev(uint32(maj), uint32(min)) + dev = unix.Mkdev(uint32(major), uint32(minor)) if mode&os.ModeCharDevice != 0 { m |= unix.S_IFCHR diff --git a/driver/driver.go b/driver/driver.go index e5d9d0f8..9004cbe2 100644 --- a/driver/driver.go +++ b/driver/driver.go @@ -109,7 +109,7 @@ type LXAttrDriver interface { } type DeviceInfoDriver interface { - DeviceInfo(fi os.FileInfo) (maj uint64, min uint64, err error) + DeviceInfo(fi os.FileInfo) (major uint64, minor uint64, err error) } // driver is a simple default implementation that sends calls out to the "os" diff --git a/driver/driver_unix.go b/driver/driver_unix.go index ea205f4a..dc985236 100644 --- a/driver/driver_unix.go +++ b/driver/driver_unix.go @@ -128,6 +128,6 @@ func (d *driver) LSetxattr(path string, attrMap map[string][]byte) error { return nil } -func (d *driver) DeviceInfo(fi os.FileInfo) (maj uint64, min uint64, err error) { +func (d *driver) DeviceInfo(fi os.FileInfo) (major uint64, minor uint64, err error) { return devices.DeviceInfo(fi) } diff --git a/fs/diff_linux.go b/fs/diff_linux.go index 376f13c2..e8c67024 100644 --- a/fs/diff_linux.go +++ b/fs/diff_linux.go @@ -51,11 +51,11 @@ func overlayFSWhiteoutConvert(diffDir, path string, f os.FileInfo, changeFn Chan return false, nil } - maj, min, err := devices.DeviceInfo(f) + major, minor, err := devices.DeviceInfo(f) if err != nil { return false, err } - return (maj == 0 && min == 0), nil + return (major == 0 && minor == 0), nil } if f.IsDir() { diff --git a/fs/fstest/file.go b/fs/fstest/file.go index 97e882ea..efdb6674 100644 --- a/fs/fstest/file.go +++ b/fs/fstest/file.go @@ -111,9 +111,9 @@ func CreateDir(name string, perm os.FileMode) Applier { } // Rename returns a file applier which renames a file -func Rename(old, new string) Applier { +func Rename(oldpath, newpath string) Applier { return applyFn(func(root string) error { - return os.Rename(filepath.Join(root, old), filepath.Join(root, new)) + return os.Rename(filepath.Join(root, oldpath), filepath.Join(root, newpath)) }) } diff --git a/fs/fstest/file_unix.go b/fs/fstest/file_unix.go index a19e3e5f..738ffe79 100644 --- a/fs/fstest/file_unix.go +++ b/fs/fstest/file_unix.go @@ -48,10 +48,10 @@ func Lchtimes(name string, atime, mtime time.Time) Applier { } // CreateDeviceFile provides creates devices Applier. -func CreateDeviceFile(name string, mode os.FileMode, maj, min int) Applier { +func CreateDeviceFile(name string, mode os.FileMode, major, minor int) Applier { return applyFn(func(root string) error { fullPath := filepath.Join(root, name) - return devices.Mknod(fullPath, mode, maj, min) + return devices.Mknod(fullPath, mode, major, minor) }) } diff --git a/fs/fstest/file_windows.go b/fs/fstest/file_windows.go index 3833169c..03fd5af8 100644 --- a/fs/fstest/file_windows.go +++ b/fs/fstest/file_windows.go @@ -37,7 +37,7 @@ func Lchtimes(name string, atime, mtime time.Time) Applier { } // CreateDeviceFile provides creates devices Applier. -func CreateDeviceFile(name string, mode os.FileMode, maj, min int) Applier { +func CreateDeviceFile(name string, mode os.FileMode, major, minor int) Applier { return applyFn(func(root string) error { return errors.New("Not implemented") }) From 738e83fb1e3ee69ee455895a73f28ac9417d0b88 Mon Sep 17 00:00:00 2001 From: Austin Vazquez Date: Wed, 20 Nov 2024 20:53:36 -0700 Subject: [PATCH 2/2] Bump golangci-lint to v1.62.0 Signed-off-by: Austin Vazquez --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f8caeec2..735e8584 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,7 +63,7 @@ jobs: fetch-depth: 25 - name: Dependencies - run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.0 + run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.62.0 - name: Lint shell: bash