Skip to content

Commit 157c4da

Browse files
authored
Merge pull request #268 from thaJeztah/gofumpt_and_updates
gof(ump)t code and update some dependencies
2 parents 960ef05 + f8eaded commit 157c4da

File tree

15 files changed

+42
-89
lines changed

15 files changed

+42
-89
lines changed

cgroup1/blkio.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,6 @@ type deviceKey struct {
331331
// keyed by major and minor number. Since devices may be mapped multiple times,
332332
// we err on taking the first occurrence.
333333
func getDevices(r io.Reader) (map[deviceKey]string, error) {
334-
335334
var (
336335
s = bufio.NewScanner(r)
337336
devices = make(map[deviceKey]string)

cgroup1/blkio_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ func TestGetDevices(t *testing.T) {
4545
t.Fatal(err)
4646
}
4747
for dev, expected := range map[deviceKey]string{
48-
deviceKey{7, 0}: "/dev/loop0",
49-
deviceKey{259, 0}: "/dev/nvme0n1",
50-
deviceKey{259, 1}: "/dev/nvme0n1p1",
48+
{7, 0}: "/dev/loop0",
49+
{259, 0}: "/dev/nvme0n1",
50+
{259, 1}: "/dev/nvme0n1p1",
5151
} {
5252
name, ok := devices[dev]
5353
if !ok {

cgroup1/cgroup.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ func (c *cgroup) subsystemsFilter(subsystems ...Name) []Subsystem {
158158
return c.subsystems
159159
}
160160

161-
var filteredSubsystems = []Subsystem{}
161+
filteredSubsystems := []Subsystem{}
162162
for _, s := range c.subsystems {
163163
for _, f := range subsystems {
164164
if s.Name() == f {

cgroup1/control.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ type procType = string
2828
const (
2929
cgroupProcs procType = "cgroup.procs"
3030
cgroupTasks procType = "tasks"
31-
defaultDirPerm = 0755
31+
defaultDirPerm = 0o755
3232
)
3333

3434
// defaultFilePerm is a var so that the test framework can change the filemode

cgroup1/memory.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ func (m *memoryController) memoryEvent(path string, event MemoryEvent) (uintptr,
472472
defer evtFile.Close()
473473
data := fmt.Sprintf("%d %d %s", efd, evtFile.Fd(), event.Arg())
474474
evctlPath := filepath.Join(root, "cgroup.event_control")
475-
if err := os.WriteFile(evctlPath, []byte(data), 0700); err != nil {
475+
if err := os.WriteFile(evctlPath, []byte(data), 0o700); err != nil {
476476
unix.Close(efd)
477477
return 0, err
478478
}

cgroup1/mock_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323
)
2424

2525
func init() {
26-
defaultFilePerm = 0666
26+
defaultFilePerm = 0o666
2727
}
2828

2929
func newMock(tb testing.TB) (*mockCgroup, error) {

cgroup1/rdma.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ func toRdmaEntry(strEntries []string) []*v1.RdmaEntry {
124124
}
125125

126126
func (p *rdmaController) Stat(path string, stats *v1.Metrics) error {
127-
128127
currentData, err := os.ReadFile(filepath.Join(p.Path(path), "rdma.current"))
129128
if err != nil {
130129
return err

cgroup2/devicefilter_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ func TestDeviceFilter_Privileged(t *testing.T) {
7777
Allow: true,
7878
},
7979
}
80-
expected :=
81-
`
80+
expected := `
8281
// load parameters into registers
8382
0: LdXMemH dst: r2 src: r1 off: 0 imm: 0
8483
1: LdXMemW dst: r3 src: r1 off: 0 imm: 0

cgroup2/hugetlbv2_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,4 @@ func TestCgroupv2HugetlbStats(t *testing.T) {
4848
break
4949
}
5050
}
51-
5251
}

cgroup2/manager.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ const (
4747
defaultSlice = "system.slice"
4848
)
4949

50-
var (
51-
canDelegate bool
52-
)
50+
var canDelegate bool
5351

5452
type Event struct {
5553
Low uint64
@@ -818,7 +816,7 @@ func setDevices(path string, devices []specs.LinuxDeviceCgroup) error {
818816
if err != nil {
819817
return err
820818
}
821-
dirFD, err := unix.Open(path, unix.O_DIRECTORY|unix.O_RDONLY|unix.O_CLOEXEC, 0600)
819+
dirFD, err := unix.Open(path, unix.O_DIRECTORY|unix.O_RDONLY|unix.O_CLOEXEC, 0o600)
822820
if err != nil {
823821
return fmt.Errorf("cannot get dir FD for %s", path)
824822
}

0 commit comments

Comments
 (0)