mirror of
				https://github.com/moby/moby.git
				synced 2022-11-09 12:21:53 -05:00 
			
		
		
		
	reformat "nolint" comments
Unlike regular comments, nolint comments should not have a leading space. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
		
							parent
							
								
									dd1374f7b2
								
							
						
					
					
						commit
						bb17074119
					
				
					 17 changed files with 28 additions and 28 deletions
				
			
		| 
						 | 
				
			
			@ -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
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 <maj> and minor <min>
 | 
			
		||||
	//	- If <inode> 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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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...)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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))
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue