Browse code

reformat "nolint" comments

Unlike regular comments, nolint comments should not have a leading space.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2021/05/31 18:39:04
Showing 17 changed files
... ...
@@ -11,7 +11,7 @@ func detectDefaultGCCap(root string) int64 {
11 11
 	if err := syscall.Statfs(root, &st); err != nil {
12 12
 		return defaultCap
13 13
 	}
14
-	diskSize := int64(st.Bsize) * int64(st.Blocks) // nolint unconvert
14
+	diskSize := int64(st.Bsize) * int64(st.Blocks) //nolint unconvert
15 15
 	avail := diskSize / 10
16 16
 	return (avail/(1<<30) + 1) * 1e9 // round up
17 17
 }
... ...
@@ -89,7 +89,7 @@ func verifyDefaultIpcMode(mode string) error {
89 89
 func verifyDefaultCgroupNsMode(mode string) error {
90 90
 	cm := containertypes.CgroupnsMode(mode)
91 91
 	if !cm.Valid() {
92
-		return fmt.Errorf("Default cgroup namespace mode (%v) is invalid. Use \"host\" or \"private\".", cm) // nolint: golint
92
+		return fmt.Errorf("Default cgroup namespace mode (%v) is invalid. Use \"host\" or \"private\".", cm) //nolint: golint
93 93
 	}
94 94
 
95 95
 	return nil
... ...
@@ -186,8 +186,8 @@ func getBlkioWeightDevices(config containertypes.Resources) ([]specs.LinuxWeight
186 186
 		weight := weightDevice.Weight
187 187
 		d := specs.LinuxWeightDevice{Weight: &weight}
188 188
 		// The type is 32bit on mips.
189
-		d.Major = int64(unix.Major(uint64(stat.Rdev))) // nolint: unconvert
190
-		d.Minor = int64(unix.Minor(uint64(stat.Rdev))) // nolint: unconvert
189
+		d.Major = int64(unix.Major(uint64(stat.Rdev))) //nolint: unconvert
190
+		d.Minor = int64(unix.Minor(uint64(stat.Rdev))) //nolint: unconvert
191 191
 		blkioWeightDevices = append(blkioWeightDevices, d)
192 192
 	}
193 193
 
... ...
@@ -258,8 +258,8 @@ func getBlkioThrottleDevices(devs []*blkiodev.ThrottleDevice) ([]specs.LinuxThro
258 258
 		}
259 259
 		d := specs.LinuxThrottleDevice{Rate: d.Rate}
260 260
 		// the type is 32bit on mips
261
-		d.Major = int64(unix.Major(uint64(stat.Rdev))) // nolint: unconvert
262
-		d.Minor = int64(unix.Minor(uint64(stat.Rdev))) // nolint: unconvert
261
+		d.Major = int64(unix.Major(uint64(stat.Rdev))) //nolint: unconvert
262
+		d.Minor = int64(unix.Minor(uint64(stat.Rdev))) //nolint: unconvert
263 263
 		throttleDevices = append(throttleDevices, d)
264 264
 	}
265 265
 
... ...
@@ -144,7 +144,7 @@ func DirCopy(srcDir, dstDir string, copyMode Mode, copyXattrs bool) error {
144 144
 		switch mode := f.Mode(); {
145 145
 		case mode.IsRegular():
146 146
 			// the type is 32bit on mips
147
-			id := fileID{dev: uint64(stat.Dev), ino: stat.Ino} // nolint: unconvert
147
+			id := fileID{dev: uint64(stat.Dev), ino: stat.Ino} //nolint: unconvert
148 148
 			if copyMode == Hardlink {
149 149
 				isHardlink = true
150 150
 				if err2 := os.Link(srcPath, dstPath); err2 != nil {
... ...
@@ -223,7 +223,7 @@ func DirCopy(srcDir, dstDir string, copyMode Mode, copyXattrs bool) error {
223 223
 		}
224 224
 
225 225
 		// system.Chtimes doesn't support a NOFOLLOW flag atm
226
-		// nolint: unconvert
226
+		//nolint: unconvert
227 227
 		if f.IsDir() {
228 228
 			dirsToSetMtimes.PushFront(&dirMtimeInfo{dstPath: &dstPath, stat: stat})
229 229
 		} else if !isSymlink {
... ...
@@ -1534,7 +1534,7 @@ func getDeviceMajorMinor(file *os.File) (uint64, uint64, error) {
1534 1534
 	}
1535 1535
 
1536 1536
 	// the type is 32bit on mips
1537
-	dev := uint64(stat.Rdev) // nolint: unconvert
1537
+	dev := uint64(stat.Rdev) //nolint: unconvert
1538 1538
 	majorNum := major(dev)
1539 1539
 	minorNum := minor(dev)
1540 1540
 
... ...
@@ -1746,7 +1746,7 @@ func (devices *DeviceSet) initDevmapper(doInit bool) (retErr error) {
1746 1746
 	//	- The target of this device is at major <maj> and minor <min>
1747 1747
 	//	- If <inode> is defined, use that file inside the device as a loopback image. Otherwise use the device itself.
1748 1748
 	// The type Dev in Stat_t is 32bit on mips.
1749
-	devices.devicePrefix = fmt.Sprintf("docker-%d:%d-%d", major(uint64(st.Dev)), minor(uint64(st.Dev)), st.Ino) // nolint: unconvert
1749
+	devices.devicePrefix = fmt.Sprintf("docker-%d:%d-%d", major(uint64(st.Dev)), minor(uint64(st.Dev)), st.Ino) //nolint: unconvert
1750 1750
 	logger.Debugf("Generated prefix: %s", devices.devicePrefix)
1751 1751
 
1752 1752
 	// Check for the existence of the thin-pool device
... ...
@@ -41,7 +41,7 @@ func initLoopbacks() error {
41 41
 		// only create new loopback files if they don't exist
42 42
 		if _, err := os.Stat(loopPath); err != nil {
43 43
 			if mkerr := syscall.Mknod(loopPath,
44
-				uint32(statT.Mode|syscall.S_IFBLK), int((7<<8)|(i&0xff)|((i&0xfff00)<<12))); mkerr != nil { // nolint: unconvert
44
+				uint32(statT.Mode|syscall.S_IFBLK), int((7<<8)|(i&0xff)|((i&0xfff00)<<12))); mkerr != nil { //nolint: unconvert
45 45
 				return mkerr
46 46
 			}
47 47
 			os.Chown(loopPath, int(statT.Uid), int(statT.Gid))
... ...
@@ -155,7 +155,7 @@ var (
155 155
 func (daemon *Daemon) startIngressWorker() {
156 156
 	ingressJobsChannel = make(chan *ingressJob, 100)
157 157
 	go func() {
158
-		// nolint: gosimple
158
+		//nolint: gosimple
159 159
 		for {
160 160
 			select {
161 161
 			case r := <-ingressJobsChannel:
... ...
@@ -365,7 +365,7 @@ func (daemon *Daemon) createNetwork(create types.NetworkCreateRequest, id string
365 365
 	n, err := c.NewNetwork(driver, create.Name, id, nwOptions...)
366 366
 	if err != nil {
367 367
 		if _, ok := err.(libnetwork.ErrDataStoreNotInitialized); ok {
368
-			// nolint: golint
368
+			//nolint: golint
369 369
 			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.")
370 370
 		}
371 371
 		return nil, err
... ...
@@ -20,7 +20,7 @@ func validatePSArgs(psArgs string) error {
20 20
 	// NOTE: \\s does not detect unicode whitespaces.
21 21
 	// So we use fieldsASCII instead of strings.Fields in parsePSOutput.
22 22
 	// See https://github.com/docker/docker/pull/24358
23
-	// nolint: gosimple
23
+	//nolint: gosimple
24 24
 	re := regexp.MustCompile("\\s+([^\\s]*)=\\s*(PID[^\\s]*)")
25 25
 	for _, group := range re.FindAllStringSubmatch(psArgs, -1) {
26 26
 		if len(group) >= 3 {
... ...
@@ -26,7 +26,7 @@ func Create(ctx context.Context, client client.APIClient, name string, ops ...fu
26 26
 }
27 27
 
28 28
 // CreateNoError creates a network with the specified options and verifies there were no errors
29
-func CreateNoError(ctx context.Context, t *testing.T, client client.APIClient, name string, ops ...func(*types.NetworkCreate)) string { // nolint: golint
29
+func CreateNoError(ctx context.Context, t *testing.T, client client.APIClient, name string, ops ...func(*types.NetworkCreate)) string { //nolint: golint
30 30
 	t.Helper()
31 31
 
32 32
 	name, err := createNetwork(ctx, client, name, ops...)
... ...
@@ -13,7 +13,7 @@ import (
13 13
 //      that *only* passes `a` as value: `echo a > /sys/fs/cgroup/1/devices.allow, which would be
14 14
 //      the "implicit" equivalent of "a *:* rwm". Source-code also looks to confirm this, and returns
15 15
 //      early for "a" (all); https://github.com/torvalds/linux/blob/v5.10/security/device_cgroup.c#L614-L642
16
-// nolint: gosimple
16
+//nolint: gosimple
17 17
 var deviceCgroupRuleRegex = regexp.MustCompile("^([acb]) ([0-9]+|\\*):([0-9]+|\\*) ([rwm]{1,3})$")
18 18
 
19 19
 // SetCapabilities sets the provided capabilities on the spec
... ...
@@ -51,8 +51,8 @@ func setHeaderForSpecialDevice(hdr *tar.Header, name string, stat interface{}) (
51 51
 		// Currently go does not fill in the major/minors
52 52
 		if s.Mode&unix.S_IFBLK != 0 ||
53 53
 			s.Mode&unix.S_IFCHR != 0 {
54
-			hdr.Devmajor = int64(unix.Major(uint64(s.Rdev))) // nolint: unconvert
55
-			hdr.Devminor = int64(unix.Minor(uint64(s.Rdev))) // nolint: unconvert
54
+			hdr.Devmajor = int64(unix.Major(uint64(s.Rdev))) //nolint: unconvert
55
+			hdr.Devminor = int64(unix.Minor(uint64(s.Rdev))) //nolint: unconvert
56 56
 		}
57 57
 	}
58 58
 
... ...
@@ -186,7 +186,7 @@ func getNlink(path string) (uint64, error) {
186 186
 		return 0, fmt.Errorf("expected type *syscall.Stat_t, got %t", stat.Sys())
187 187
 	}
188 188
 	// We need this conversion on ARM64
189
-	// nolint: unconvert
189
+	//nolint: unconvert
190 190
 	return uint64(statT.Nlink), nil
191 191
 }
192 192
 
... ...
@@ -14,7 +14,7 @@ import (
14 14
 )
15 15
 
16 16
 // Same as DM_DEVICE_* enum values from libdevmapper.h
17
-// nolint: deadcode,unused,varcheck
17
+//nolint: deadcode,unused,varcheck
18 18
 const (
19 19
 	deviceCreate TaskType = iota
20 20
 	deviceReload
... ...
@@ -38,7 +38,7 @@ func FindLoopDeviceFor(file *os.File) *os.File {
38 38
 	}
39 39
 	targetInode := stat.Ino
40 40
 	// the type is 32bit on mips
41
-	targetDevice := uint64(stat.Dev) // nolint: unconvert
41
+	targetDevice := uint64(stat.Dev) //nolint: unconvert
42 42
 
43 43
 	for i := 0; true; i++ {
44 44
 		path := fmt.Sprintf("/dev/loop%d", i)
... ...
@@ -26,7 +26,7 @@ func TestChtimesLinux(t *testing.T) {
26 26
 	}
27 27
 
28 28
 	stat := f.Sys().(*syscall.Stat_t)
29
-	aTime := time.Unix(int64(stat.Atim.Sec), int64(stat.Atim.Nsec)) // nolint: unconvert
29
+	aTime := time.Unix(int64(stat.Atim.Sec), int64(stat.Atim.Nsec)) //nolint: unconvert
30 30
 	if aTime != unixEpochTime {
31 31
 		t.Fatalf("Expected: %s, got: %s", unixEpochTime, aTime)
32 32
 	}
... ...
@@ -40,7 +40,7 @@ func TestChtimesLinux(t *testing.T) {
40 40
 	}
41 41
 
42 42
 	stat = f.Sys().(*syscall.Stat_t)
43
-	aTime = time.Unix(int64(stat.Atim.Sec), int64(stat.Atim.Nsec)) // nolint: unconvert
43
+	aTime = time.Unix(int64(stat.Atim.Sec), int64(stat.Atim.Nsec)) //nolint: unconvert
44 44
 	if aTime != unixEpochTime {
45 45
 		t.Fatalf("Expected: %s, got: %s", unixEpochTime, aTime)
46 46
 	}
... ...
@@ -54,7 +54,7 @@ func TestChtimesLinux(t *testing.T) {
54 54
 	}
55 55
 
56 56
 	stat = f.Sys().(*syscall.Stat_t)
57
-	aTime = time.Unix(int64(stat.Atim.Sec), int64(stat.Atim.Nsec)) // nolint: unconvert
57
+	aTime = time.Unix(int64(stat.Atim.Sec), int64(stat.Atim.Nsec)) //nolint: unconvert
58 58
 	if aTime != unixEpochTime {
59 59
 		t.Fatalf("Expected: %s, got: %s", unixEpochTime, aTime)
60 60
 	}
... ...
@@ -68,7 +68,7 @@ func TestChtimesLinux(t *testing.T) {
68 68
 	}
69 69
 
70 70
 	stat = f.Sys().(*syscall.Stat_t)
71
-	aTime = time.Unix(int64(stat.Atim.Sec), int64(stat.Atim.Nsec)) // nolint: unconvert
71
+	aTime = time.Unix(int64(stat.Atim.Sec), int64(stat.Atim.Nsec)) //nolint: unconvert
72 72
 	if aTime != afterUnixEpochTime {
73 73
 		t.Fatalf("Expected: %s, got: %s", afterUnixEpochTime, aTime)
74 74
 	}
... ...
@@ -82,7 +82,7 @@ func TestChtimesLinux(t *testing.T) {
82 82
 	}
83 83
 
84 84
 	stat = f.Sys().(*syscall.Stat_t)
85
-	aTime = time.Unix(int64(stat.Atim.Sec), int64(stat.Atim.Nsec)) // nolint: unconvert
85
+	aTime = time.Unix(int64(stat.Atim.Sec), int64(stat.Atim.Nsec)) //nolint: unconvert
86 86
 	if aTime.Truncate(time.Second) != unixMaxTime.Truncate(time.Second) {
87 87
 		t.Fatalf("Expected: %s, got: %s", unixMaxTime.Truncate(time.Second), aTime.Truncate(time.Second))
88 88
 	}
... ...
@@ -9,7 +9,7 @@ func fromStatT(s *syscall.Stat_t) (*StatT, error) {
9 9
 		uid:  s.Uid,
10 10
 		gid:  s.Gid,
11 11
 		// the type is 32bit on mips
12
-		rdev: uint64(s.Rdev), // nolint: unconvert
12
+		rdev: uint64(s.Rdev), //nolint: unconvert
13 13
 		mtim: s.Mtim}, nil
14 14
 }
15 15
 
... ...
@@ -21,7 +21,7 @@ const extName = "VolumeDriver"
21 21
 // volumeDriver defines the available functions that volume plugins must implement.
22 22
 // This interface is only defined to generate the proxy objects.
23 23
 // It's not intended to be public or reused.
24
-// nolint: deadcode
24
+//nolint: deadcode
25 25
 type volumeDriver interface {
26 26
 	// Create a volume with the given name
27 27
 	Create(name string, opts map[string]string) (err error)