From bb17074119520860bb09d145eb9e2c86bfd21330 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Mon, 31 May 2021 11:39:04 +0200 Subject: [PATCH] reformat "nolint" comments Unlike regular comments, nolint comments should not have a leading space. Signed-off-by: Sebastiaan van Stijn --- builder/builder-next/worker/gc_unix.go | 2 +- daemon/config/config_unix.go | 2 +- daemon/daemon_unix.go | 8 ++++---- daemon/graphdriver/copy/copy.go | 4 ++-- daemon/graphdriver/devmapper/deviceset.go | 4 ++-- daemon/graphdriver/devmapper/devmapper_test.go | 2 +- daemon/network.go | 4 ++-- daemon/top_unix.go | 2 +- integration/internal/network/network.go | 2 +- oci/oci.go | 2 +- pkg/archive/archive_unix.go | 4 ++-- pkg/archive/archive_unix_test.go | 2 +- pkg/devicemapper/devmapper.go | 2 +- pkg/loopback/loopback.go | 2 +- pkg/system/chtimes_linux_test.go | 10 +++++----- pkg/system/stat_linux.go | 2 +- volume/drivers/extpoint.go | 2 +- 17 files changed, 28 insertions(+), 28 deletions(-) diff --git a/builder/builder-next/worker/gc_unix.go b/builder/builder-next/worker/gc_unix.go index 7457a06654..ffa63c5aad 100644 --- a/builder/builder-next/worker/gc_unix.go +++ b/builder/builder-next/worker/gc_unix.go @@ -11,7 +11,7 @@ func detectDefaultGCCap(root string) int64 { if err := syscall.Statfs(root, &st); err != nil { return defaultCap } - diskSize := int64(st.Bsize) * int64(st.Blocks) // nolint unconvert + diskSize := int64(st.Bsize) * int64(st.Blocks) //nolint unconvert avail := diskSize / 10 return (avail/(1<<30) + 1) * 1e9 // round up } diff --git a/daemon/config/config_unix.go b/daemon/config/config_unix.go index 4a32f55cbf..2ca5309418 100644 --- a/daemon/config/config_unix.go +++ b/daemon/config/config_unix.go @@ -89,7 +89,7 @@ func verifyDefaultIpcMode(mode string) error { func verifyDefaultCgroupNsMode(mode string) error { cm := containertypes.CgroupnsMode(mode) if !cm.Valid() { - return fmt.Errorf("Default cgroup namespace mode (%v) is invalid. Use \"host\" or \"private\".", cm) // nolint: golint + return fmt.Errorf("Default cgroup namespace mode (%v) is invalid. Use \"host\" or \"private\".", cm) //nolint: golint } return nil diff --git a/daemon/daemon_unix.go b/daemon/daemon_unix.go index 34c2db8ee3..6313a39658 100644 --- a/daemon/daemon_unix.go +++ b/daemon/daemon_unix.go @@ -186,8 +186,8 @@ func getBlkioWeightDevices(config containertypes.Resources) ([]specs.LinuxWeight weight := weightDevice.Weight d := specs.LinuxWeightDevice{Weight: &weight} // The type is 32bit on mips. - d.Major = int64(unix.Major(uint64(stat.Rdev))) // nolint: unconvert - d.Minor = int64(unix.Minor(uint64(stat.Rdev))) // nolint: unconvert + d.Major = int64(unix.Major(uint64(stat.Rdev))) //nolint: unconvert + d.Minor = int64(unix.Minor(uint64(stat.Rdev))) //nolint: unconvert blkioWeightDevices = append(blkioWeightDevices, d) } @@ -258,8 +258,8 @@ func getBlkioThrottleDevices(devs []*blkiodev.ThrottleDevice) ([]specs.LinuxThro } d := specs.LinuxThrottleDevice{Rate: d.Rate} // the type is 32bit on mips - d.Major = int64(unix.Major(uint64(stat.Rdev))) // nolint: unconvert - d.Minor = int64(unix.Minor(uint64(stat.Rdev))) // nolint: unconvert + d.Major = int64(unix.Major(uint64(stat.Rdev))) //nolint: unconvert + d.Minor = int64(unix.Minor(uint64(stat.Rdev))) //nolint: unconvert throttleDevices = append(throttleDevices, d) } diff --git a/daemon/graphdriver/copy/copy.go b/daemon/graphdriver/copy/copy.go index 962eddfd7b..98188070c4 100644 --- a/daemon/graphdriver/copy/copy.go +++ b/daemon/graphdriver/copy/copy.go @@ -144,7 +144,7 @@ func DirCopy(srcDir, dstDir string, copyMode Mode, copyXattrs bool) error { switch mode := f.Mode(); { case mode.IsRegular(): // the type is 32bit on mips - id := fileID{dev: uint64(stat.Dev), ino: stat.Ino} // nolint: unconvert + id := fileID{dev: uint64(stat.Dev), ino: stat.Ino} //nolint: unconvert if copyMode == Hardlink { isHardlink = true if err2 := os.Link(srcPath, dstPath); err2 != nil { @@ -223,7 +223,7 @@ func DirCopy(srcDir, dstDir string, copyMode Mode, copyXattrs bool) error { } // system.Chtimes doesn't support a NOFOLLOW flag atm - // nolint: unconvert + //nolint: unconvert if f.IsDir() { dirsToSetMtimes.PushFront(&dirMtimeInfo{dstPath: &dstPath, stat: stat}) } else if !isSymlink { diff --git a/daemon/graphdriver/devmapper/deviceset.go b/daemon/graphdriver/devmapper/deviceset.go index 590e062123..c1b617f4dc 100644 --- a/daemon/graphdriver/devmapper/deviceset.go +++ b/daemon/graphdriver/devmapper/deviceset.go @@ -1534,7 +1534,7 @@ func getDeviceMajorMinor(file *os.File) (uint64, uint64, error) { } // the type is 32bit on mips - dev := uint64(stat.Rdev) // nolint: unconvert + dev := uint64(stat.Rdev) //nolint: unconvert majorNum := major(dev) minorNum := minor(dev) @@ -1746,7 +1746,7 @@ func (devices *DeviceSet) initDevmapper(doInit bool) (retErr error) { // - The target of this device is at major and minor // - If is defined, use that file inside the device as a loopback image. Otherwise use the device itself. // The type Dev in Stat_t is 32bit on mips. - devices.devicePrefix = fmt.Sprintf("docker-%d:%d-%d", major(uint64(st.Dev)), minor(uint64(st.Dev)), st.Ino) // nolint: unconvert + devices.devicePrefix = fmt.Sprintf("docker-%d:%d-%d", major(uint64(st.Dev)), minor(uint64(st.Dev)), st.Ino) //nolint: unconvert logger.Debugf("Generated prefix: %s", devices.devicePrefix) // Check for the existence of the thin-pool device diff --git a/daemon/graphdriver/devmapper/devmapper_test.go b/daemon/graphdriver/devmapper/devmapper_test.go index afd6c5b4d9..c530d74d9c 100644 --- a/daemon/graphdriver/devmapper/devmapper_test.go +++ b/daemon/graphdriver/devmapper/devmapper_test.go @@ -41,7 +41,7 @@ func initLoopbacks() error { // only create new loopback files if they don't exist if _, err := os.Stat(loopPath); err != nil { if mkerr := syscall.Mknod(loopPath, - uint32(statT.Mode|syscall.S_IFBLK), int((7<<8)|(i&0xff)|((i&0xfff00)<<12))); mkerr != nil { // nolint: unconvert + uint32(statT.Mode|syscall.S_IFBLK), int((7<<8)|(i&0xff)|((i&0xfff00)<<12))); mkerr != nil { //nolint: unconvert return mkerr } os.Chown(loopPath, int(statT.Uid), int(statT.Gid)) diff --git a/daemon/network.go b/daemon/network.go index 46c286025f..fc84eaa164 100644 --- a/daemon/network.go +++ b/daemon/network.go @@ -155,7 +155,7 @@ var ( func (daemon *Daemon) startIngressWorker() { ingressJobsChannel = make(chan *ingressJob, 100) go func() { - // nolint: gosimple + //nolint: gosimple for { select { case r := <-ingressJobsChannel: @@ -365,7 +365,7 @@ func (daemon *Daemon) createNetwork(create types.NetworkCreateRequest, id string n, err := c.NewNetwork(driver, create.Name, id, nwOptions...) if err != nil { if _, ok := err.(libnetwork.ErrDataStoreNotInitialized); ok { - // nolint: golint + //nolint: golint return nil, errors.New("This node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again.") } return nil, err diff --git a/daemon/top_unix.go b/daemon/top_unix.go index 570cdce2eb..cedda94bcb 100644 --- a/daemon/top_unix.go +++ b/daemon/top_unix.go @@ -20,7 +20,7 @@ func validatePSArgs(psArgs string) error { // NOTE: \\s does not detect unicode whitespaces. // So we use fieldsASCII instead of strings.Fields in parsePSOutput. // See https://github.com/docker/docker/pull/24358 - // nolint: gosimple + //nolint: gosimple re := regexp.MustCompile("\\s+([^\\s]*)=\\s*(PID[^\\s]*)") for _, group := range re.FindAllStringSubmatch(psArgs, -1) { if len(group) >= 3 { diff --git a/integration/internal/network/network.go b/integration/internal/network/network.go index 4f1f176993..04f29c7bb2 100644 --- a/integration/internal/network/network.go +++ b/integration/internal/network/network.go @@ -26,7 +26,7 @@ func Create(ctx context.Context, client client.APIClient, name string, ops ...fu } // CreateNoError creates a network with the specified options and verifies there were no errors -func CreateNoError(ctx context.Context, t *testing.T, client client.APIClient, name string, ops ...func(*types.NetworkCreate)) string { // nolint: golint +func CreateNoError(ctx context.Context, t *testing.T, client client.APIClient, name string, ops ...func(*types.NetworkCreate)) string { //nolint: golint t.Helper() name, err := createNetwork(ctx, client, name, ops...) diff --git a/oci/oci.go b/oci/oci.go index fdc1e06de2..2a4c0d79aa 100644 --- a/oci/oci.go +++ b/oci/oci.go @@ -13,7 +13,7 @@ import ( // that *only* passes `a` as value: `echo a > /sys/fs/cgroup/1/devices.allow, which would be // the "implicit" equivalent of "a *:* rwm". Source-code also looks to confirm this, and returns // early for "a" (all); https://github.com/torvalds/linux/blob/v5.10/security/device_cgroup.c#L614-L642 -// nolint: gosimple +//nolint: gosimple var deviceCgroupRuleRegex = regexp.MustCompile("^([acb]) ([0-9]+|\\*):([0-9]+|\\*) ([rwm]{1,3})$") // SetCapabilities sets the provided capabilities on the spec diff --git a/pkg/archive/archive_unix.go b/pkg/archive/archive_unix.go index 0b92bb0f4a..ef774fe6b7 100644 --- a/pkg/archive/archive_unix.go +++ b/pkg/archive/archive_unix.go @@ -51,8 +51,8 @@ func setHeaderForSpecialDevice(hdr *tar.Header, name string, stat interface{}) ( // Currently go does not fill in the major/minors if s.Mode&unix.S_IFBLK != 0 || s.Mode&unix.S_IFCHR != 0 { - hdr.Devmajor = int64(unix.Major(uint64(s.Rdev))) // nolint: unconvert - hdr.Devminor = int64(unix.Minor(uint64(s.Rdev))) // nolint: unconvert + hdr.Devmajor = int64(unix.Major(uint64(s.Rdev))) //nolint: unconvert + hdr.Devminor = int64(unix.Minor(uint64(s.Rdev))) //nolint: unconvert } } diff --git a/pkg/archive/archive_unix_test.go b/pkg/archive/archive_unix_test.go index 6274744b61..c5767785c6 100644 --- a/pkg/archive/archive_unix_test.go +++ b/pkg/archive/archive_unix_test.go @@ -186,7 +186,7 @@ func getNlink(path string) (uint64, error) { return 0, fmt.Errorf("expected type *syscall.Stat_t, got %t", stat.Sys()) } // We need this conversion on ARM64 - // nolint: unconvert + //nolint: unconvert return uint64(statT.Nlink), nil } diff --git a/pkg/devicemapper/devmapper.go b/pkg/devicemapper/devmapper.go index edc6009ff3..926ae8a7b7 100644 --- a/pkg/devicemapper/devmapper.go +++ b/pkg/devicemapper/devmapper.go @@ -14,7 +14,7 @@ import ( ) // Same as DM_DEVICE_* enum values from libdevmapper.h -// nolint: deadcode,unused,varcheck +//nolint: deadcode,unused,varcheck const ( deviceCreate TaskType = iota deviceReload diff --git a/pkg/loopback/loopback.go b/pkg/loopback/loopback.go index 40fde96621..5e0def6c56 100644 --- a/pkg/loopback/loopback.go +++ b/pkg/loopback/loopback.go @@ -38,7 +38,7 @@ func FindLoopDeviceFor(file *os.File) *os.File { } targetInode := stat.Ino // the type is 32bit on mips - targetDevice := uint64(stat.Dev) // nolint: unconvert + targetDevice := uint64(stat.Dev) //nolint: unconvert for i := 0; true; i++ { path := fmt.Sprintf("/dev/loop%d", i) diff --git a/pkg/system/chtimes_linux_test.go b/pkg/system/chtimes_linux_test.go index 273fc0a893..075f573059 100644 --- a/pkg/system/chtimes_linux_test.go +++ b/pkg/system/chtimes_linux_test.go @@ -26,7 +26,7 @@ func TestChtimesLinux(t *testing.T) { } stat := f.Sys().(*syscall.Stat_t) - aTime := time.Unix(int64(stat.Atim.Sec), int64(stat.Atim.Nsec)) // nolint: unconvert + aTime := time.Unix(int64(stat.Atim.Sec), int64(stat.Atim.Nsec)) //nolint: unconvert if aTime != unixEpochTime { t.Fatalf("Expected: %s, got: %s", unixEpochTime, aTime) } @@ -40,7 +40,7 @@ func TestChtimesLinux(t *testing.T) { } stat = f.Sys().(*syscall.Stat_t) - aTime = time.Unix(int64(stat.Atim.Sec), int64(stat.Atim.Nsec)) // nolint: unconvert + aTime = time.Unix(int64(stat.Atim.Sec), int64(stat.Atim.Nsec)) //nolint: unconvert if aTime != unixEpochTime { t.Fatalf("Expected: %s, got: %s", unixEpochTime, aTime) } @@ -54,7 +54,7 @@ func TestChtimesLinux(t *testing.T) { } stat = f.Sys().(*syscall.Stat_t) - aTime = time.Unix(int64(stat.Atim.Sec), int64(stat.Atim.Nsec)) // nolint: unconvert + aTime = time.Unix(int64(stat.Atim.Sec), int64(stat.Atim.Nsec)) //nolint: unconvert if aTime != unixEpochTime { t.Fatalf("Expected: %s, got: %s", unixEpochTime, aTime) } @@ -68,7 +68,7 @@ func TestChtimesLinux(t *testing.T) { } stat = f.Sys().(*syscall.Stat_t) - aTime = time.Unix(int64(stat.Atim.Sec), int64(stat.Atim.Nsec)) // nolint: unconvert + aTime = time.Unix(int64(stat.Atim.Sec), int64(stat.Atim.Nsec)) //nolint: unconvert if aTime != afterUnixEpochTime { t.Fatalf("Expected: %s, got: %s", afterUnixEpochTime, aTime) } @@ -82,7 +82,7 @@ func TestChtimesLinux(t *testing.T) { } stat = f.Sys().(*syscall.Stat_t) - aTime = time.Unix(int64(stat.Atim.Sec), int64(stat.Atim.Nsec)) // nolint: unconvert + aTime = time.Unix(int64(stat.Atim.Sec), int64(stat.Atim.Nsec)) //nolint: unconvert if aTime.Truncate(time.Second) != unixMaxTime.Truncate(time.Second) { t.Fatalf("Expected: %s, got: %s", unixMaxTime.Truncate(time.Second), aTime.Truncate(time.Second)) } diff --git a/pkg/system/stat_linux.go b/pkg/system/stat_linux.go index 17d5d131a3..3ac02393f0 100644 --- a/pkg/system/stat_linux.go +++ b/pkg/system/stat_linux.go @@ -9,7 +9,7 @@ func fromStatT(s *syscall.Stat_t) (*StatT, error) { uid: s.Uid, gid: s.Gid, // the type is 32bit on mips - rdev: uint64(s.Rdev), // nolint: unconvert + rdev: uint64(s.Rdev), //nolint: unconvert mtim: s.Mtim}, nil } diff --git a/volume/drivers/extpoint.go b/volume/drivers/extpoint.go index dbe0086ab6..3878736cbb 100644 --- a/volume/drivers/extpoint.go +++ b/volume/drivers/extpoint.go @@ -21,7 +21,7 @@ const extName = "VolumeDriver" // volumeDriver defines the available functions that volume plugins must implement. // This interface is only defined to generate the proxy objects. // It's not intended to be public or reused. -// nolint: deadcode +//nolint: deadcode type volumeDriver interface { // Create a volume with the given name Create(name string, opts map[string]string) (err error)