Skip to content

Commit 64c3c8e

Browse files
authored
Merge pull request #4994 from kolyshkin/gofumpt-extra
Enable gofumpt extra rules
2 parents 52c3a0e + 67840cc commit 64c3c8e

File tree

16 files changed

+19
-16
lines changed

16 files changed

+19
-16
lines changed

.golangci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ run:
77
formatters:
88
enable:
99
- gofumpt
10+
settings:
11+
gofumpt:
12+
extra-rules: true
1013

1114
linters:
1215
enable:

internal/linux/linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func Dup3(oldfd, newfd, flags int) error {
1515
}
1616

1717
// Exec wraps [unix.Exec].
18-
func Exec(cmd string, args []string, env []string) error {
18+
func Exec(cmd string, args, env []string) error {
1919
err := retryOnEINTR(func() error {
2020
return unix.Exec(cmd, args, env)
2121
})

libcontainer/criu_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func (c *Container) checkCriuFeatures(criuOpts *CriuOpts, criuFeat *criurpc.Criu
8080
return nil
8181
}
8282

83-
func compareCriuVersion(criuVersion int, minVersion int) error {
83+
func compareCriuVersion(criuVersion, minVersion int) error {
8484
// simple function to perform the actual version compare
8585
if criuVersion < minVersion {
8686
return fmt.Errorf("CRIU version %d must be %d or higher", criuVersion, minVersion)

libcontainer/integration/exec_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ func TestFreeze(t *testing.T) {
435435
}
436436
}
437437

438-
func testFreeze(t *testing.T, withSystemd bool, useSet bool) {
438+
func testFreeze(t *testing.T, withSystemd, useSet bool) {
439439
if testing.Short() {
440440
return
441441
}

libcontainer/intelrdt/cmt_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func TestGetCMTNumaNodeStats(t *testing.T) {
3535
})
3636
}
3737

38-
func checkCMTStatCorrection(got CMTNumaNodeStats, expected CMTNumaNodeStats, t *testing.T) {
38+
func checkCMTStatCorrection(got, expected CMTNumaNodeStats, t *testing.T) {
3939
if got.LLCOccupancy != expected.LLCOccupancy {
4040
t.Fatalf("Wrong value of `llc_occupancy`. Expected: %v but got: %v",
4141
expected.LLCOccupancy,

libcontainer/intelrdt/intelrdt.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ type Manager struct {
156156
// NewManager returns a new instance of Manager, or nil if the Intel RDT
157157
// functionality is not specified in the config, available from hardware or
158158
// enabled in the kernel.
159-
func NewManager(config *configs.Config, id string, path string) *Manager {
159+
func NewManager(config *configs.Config, id, path string) *Manager {
160160
if config.IntelRdt == nil {
161161
return nil
162162
}
@@ -184,7 +184,7 @@ func NewManager(config *configs.Config, id string, path string) *Manager {
184184

185185
// newManager is the same as NewManager, except it does not check if the feature
186186
// is actually available. Used by unit tests that mock intelrdt paths.
187-
func newManager(config *configs.Config, id string, path string) *Manager {
187+
func newManager(config *configs.Config, id, path string) *Manager {
188188
return &Manager{
189189
config: config,
190190
id: id,

libcontainer/intelrdt/mbm_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func TestGetMBMNumaNodeStats(t *testing.T) {
3838
})
3939
}
4040

41-
func checkMBMStatCorrection(got MBMNumaNodeStats, expected MBMNumaNodeStats, t *testing.T) {
41+
func checkMBMStatCorrection(got, expected MBMNumaNodeStats, t *testing.T) {
4242
if got.MBMTotalBytes != expected.MBMTotalBytes {
4343
t.Fatalf("Wrong value of mbm_total_bytes. Expected: %v but got: %v",
4444
expected.MBMTotalBytes,

libcontainer/internal/userns/userns_maps_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func parseIdmapData(data []byte) (ms []configs.IDMap, err error) {
3939
// Do something equivalent to nsenter --user=<nsPath> cat <path>, but more
4040
// efficiently. Returns the contents of the requested file from within the user
4141
// namespace.
42-
func spawnUserNamespaceCat(nsPath string, path string) ([]byte, error) {
42+
func spawnUserNamespaceCat(nsPath, path string) ([]byte, error) {
4343
rdr, wtr, err := os.Pipe()
4444
if err != nil {
4545
return nil, fmt.Errorf("create pipe for userns spawn failed: %w", err)

libcontainer/logs/logs_linux_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func check(t *testing.T, l *log, txt, notxt string) {
142142

143143
// checkWait is like check, but if the file is empty,
144144
// it waits until it's not.
145-
func checkWait(t *testing.T, l *log, txt string, notxt string) {
145+
func checkWait(t *testing.T, l *log, txt, notxt string) {
146146
t.Helper()
147147
const (
148148
delay = 100 * time.Millisecond

libcontainer/network_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func (l *loopback) detach(n *configs.Network) (err error) {
110110
// The device name will be kept the same if device.Name is the zero value.
111111
// This function ensures that the move and rename operations occur atomically.
112112
// It preserves existing interface attributes, including global IP addresses.
113-
func devChangeNetNamespace(name string, nsPath string, device configs.LinuxNetDevice) error {
113+
func devChangeNetNamespace(name, nsPath string, device configs.LinuxNetDevice) error {
114114
logrus.Debugf("attaching network device %s with attrs %+v to network namespace %s", name, device, nsPath)
115115
link, err := netlink.LinkByName(name)
116116
// recover same behavior on vishvananda/[email protected] and do not fail when the kernel returns NLM_F_DUMP_INTR.

0 commit comments

Comments
 (0)