diff --git a/pkg/seccomp/seccomp.go b/pkg/seccomp/seccomp.go index cd6b0b4bc..49da3c775 100644 --- a/pkg/seccomp/seccomp.go +++ b/pkg/seccomp/seccomp.go @@ -98,7 +98,7 @@ func buildProgram(rules SyscallRules, kill bool) ([]linux.BPFInstruction, error) // buildIndex builds a BST to quickly search through all syscalls that are whitelisted. func buildIndex(rules SyscallRules, program *bpf.ProgramBuilder) error { syscalls := []uintptr{} - for sysno, _ := range rules { + for sysno := range rules { syscalls = append(syscalls, sysno) } diff --git a/pkg/seccomp/seccomp_rules.go b/pkg/seccomp/seccomp_rules.go index 4b99792fd..9215e5c90 100644 --- a/pkg/seccomp/seccomp_rules.go +++ b/pkg/seccomp/seccomp_rules.go @@ -120,7 +120,7 @@ func (sr SyscallRules) Merge(rules SyscallRules) { sr[sysno] = append(sr[sysno], Rule{}) } if len(rs) == 0 { - rs = []Rule{Rule{}} + rs = []Rule{{}} } sr[sysno] = append(sr[sysno], rs...) } else { diff --git a/pkg/seccomp/seccomp_test.go b/pkg/seccomp/seccomp_test.go index 9f9507228..42cf85c03 100644 --- a/pkg/seccomp/seccomp_test.go +++ b/pkg/seccomp/seccomp_test.go @@ -368,19 +368,19 @@ func TestMerge(t *testing.T) { name: "empty both", main: nil, merge: nil, - want: []Rule{Rule{}, Rule{}}, + want: []Rule{{}, {}}, }, { name: "empty main", main: nil, - merge: []Rule{Rule{}}, - want: []Rule{Rule{}, Rule{}}, + merge: []Rule{{}}, + want: []Rule{{}, {}}, }, { name: "empty merge", - main: []Rule{Rule{}}, + main: []Rule{{}}, merge: nil, - want: []Rule{Rule{}, Rule{}}, + want: []Rule{{}, {}}, }, } { t.Run(tst.name, func(t *testing.T) { diff --git a/runsc/container/container_test.go b/runsc/container/container_test.go index 996d80a89..083054877 100644 --- a/runsc/container/container_test.go +++ b/runsc/container/container_test.go @@ -735,13 +735,11 @@ func TestUnixDomainSockets(t *testing.T) { UID: uint32(os.Getuid()), GID: uint32(os.Getgid()), } - spec.Mounts = []specs.Mount{ - specs.Mount{ - Type: "bind", - Destination: dir, - Source: dir, - }, - } + spec.Mounts = []specs.Mount{{ + Type: "bind", + Destination: dir, + Source: dir, + }} rootDir, bundleDir, err := testutil.SetupContainer(spec, conf) if err != nil { diff --git a/runsc/fsgofer/filter/config.go b/runsc/fsgofer/filter/config.go index 0a1c63753..35698f21f 100644 --- a/runsc/fsgofer/filter/config.go +++ b/runsc/fsgofer/filter/config.go @@ -65,15 +65,15 @@ var allowedSyscalls = seccomp.SyscallRules{ syscall.SYS_FCHMOD: {}, syscall.SYS_FCHOWNAT: {}, syscall.SYS_FCNTL: []seccomp.Rule{ - seccomp.Rule{ + { seccomp.AllowAny{}, seccomp.AllowValue(syscall.F_GETFL), }, - seccomp.Rule{ + { seccomp.AllowAny{}, seccomp.AllowValue(syscall.F_SETFL), }, - seccomp.Rule{ + { seccomp.AllowAny{}, seccomp.AllowValue(syscall.F_GETFD), }, diff --git a/runsc/test/testutil/testutil.go b/runsc/test/testutil/testutil.go index 2e7f95912..37927f395 100644 --- a/runsc/test/testutil/testutil.go +++ b/runsc/test/testutil/testutil.go @@ -134,7 +134,7 @@ func NewSpecWithArgs(args ...string) *specs.Spec { // This creates a writable mount inside the root. Also, when tmpdir points // to "/tmp", it makes the the actual /tmp to be mounted and not a tmpfs // inside the sentry. - specs.Mount{ + { Type: "bind", Destination: TmpDir(), Source: TmpDir(),