Skip to content

Commit

Permalink
reformat "nolint" comments
Browse files Browse the repository at this point in the history
Unlike regular comments, nolint comments should not have a leading space.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
  • Loading branch information
thaJeztah committed Jun 10, 2021
1 parent dd1374f commit bb17074
Show file tree
Hide file tree
Showing 17 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion builder/builder-next/worker/gc_unix.go
Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion daemon/config/config_unix.go
Expand 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
Expand Down
8 changes: 4 additions & 4 deletions daemon/daemon_unix.go
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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)
}

Expand Down
4 changes: 2 additions & 2 deletions daemon/graphdriver/copy/copy.go
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions daemon/graphdriver/devmapper/deviceset.go
Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion daemon/graphdriver/devmapper/devmapper_test.go
Expand Up @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions daemon/network.go
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion daemon/top_unix.go
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion integration/internal/network/network.go
Expand Up @@ -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...)
Expand Down
2 changes: 1 addition & 1 deletion oci/oci.go
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pkg/archive/archive_unix.go
Expand Up @@ -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
}
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/archive/archive_unix_test.go
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/devicemapper/devmapper.go
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/loopback/loopback.go
Expand Up @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions pkg/system/chtimes_linux_test.go
Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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))
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/system/stat_linux.go
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion volume/drivers/extpoint.go
Expand Up @@ -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)
Expand Down

0 comments on commit bb17074

Please sign in to comment.