Skip to content

Commit 0bfc29a

Browse files
kolyshkindrakenclimber
authored andcommitted
*: gofumpt
This is a result of running "gofumpt -w *.go" on the source code. gofumpt[1] is a tool similar to (and based on) gofmt, which adds some some extra rules for better code formatting. Here, it removes some extra vertical whitespace, and replaces a var() block with a single element inside with a mere var declaration. Both make sense. Enable gofumpt in golangci-lint config to make sure future commits are gofumpt-ed. [1] https://github.com/mvdan/gofumpt Signed-off-by: Kir Kolyshkin <[email protected]> Acked-by: Paul Moore <[email protected]> Signed-off-by: Tom Hromatka <[email protected]>
1 parent 5444a06 commit 0bfc29a

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

.golangci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# For documentation, see https://golangci-lint.run/usage/configuration/
2+
linters:
3+
enable:
4+
- gofumpt

seccomp.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ func (e VersionError) Error() string {
5656
}
5757
return fmt.Sprintf("%s requires libseccomp >= %s (current version: %d.%d.%d)",
5858
e.op, e.minVer, verMajor, verMinor, verMicro)
59-
6059
}
6160

6261
// ScmpArch represents a CPU architecture. Seccomp can restrict syscalls on a
@@ -252,11 +251,9 @@ const (
252251
CompareMaskedEqual ScmpCompareOp = iota
253252
)
254253

255-
var (
256-
// ErrSyscallDoesNotExist represents an error condition where
257-
// libseccomp is unable to resolve the syscall
258-
ErrSyscallDoesNotExist = fmt.Errorf("could not resolve syscall name")
259-
)
254+
// ErrSyscallDoesNotExist represents an error condition where
255+
// libseccomp is unable to resolve the syscall
256+
var ErrSyscallDoesNotExist = fmt.Errorf("could not resolve syscall name")
260257

261258
const (
262259
// Userspace notification response flags

seccomp_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ func APILevelIsSupported() bool {
6969
func TestGetAPILevel(t *testing.T) {
7070
execInSubprocess(t, subprocessGetAPILevel)
7171
}
72+
7273
func subprocessGetAPILevel(t *testing.T) {
7374
api, err := GetAPI()
7475
if !APILevelIsSupported() {
@@ -88,6 +89,7 @@ func subprocessGetAPILevel(t *testing.T) {
8889
func TestSetAPILevel(t *testing.T) {
8990
execInSubprocess(t, subprocessSetAPILevel)
9091
}
92+
9193
func subprocessSetAPILevel(t *testing.T) {
9294
const expectedAPI = uint(1)
9395

@@ -560,6 +562,7 @@ func TestMergeFilters(t *testing.T) {
560562
func TestRuleAddAndLoad(t *testing.T) {
561563
execInSubprocess(t, subprocessRuleAddAndLoad)
562564
}
565+
563566
func subprocessRuleAddAndLoad(t *testing.T) {
564567
// Test #1: Add a trivial filter
565568
filter1, err := NewFilter(ActAllow)
@@ -636,6 +639,7 @@ func subprocessRuleAddAndLoad(t *testing.T) {
636639
func TestLogAct(t *testing.T) {
637640
execInSubprocess(t, subprocessLogAct)
638641
}
642+
639643
func subprocessLogAct(t *testing.T) {
640644
expectedPid := syscall.Getpid()
641645

@@ -681,6 +685,7 @@ func subprocessLogAct(t *testing.T) {
681685
func TestCreateActKillThreadFilter(t *testing.T) {
682686
execInSubprocess(t, subprocessCreateActKillThreadFilter)
683687
}
688+
684689
func subprocessCreateActKillThreadFilter(t *testing.T) {
685690
filter, err := NewFilter(ActKillThread)
686691
if err != nil {
@@ -695,6 +700,7 @@ func subprocessCreateActKillThreadFilter(t *testing.T) {
695700
func TestCreateActKillProcessFilter(t *testing.T) {
696701
execInSubprocess(t, subprocessCreateActKillProcessFilter)
697702
}
703+
698704
func subprocessCreateActKillProcessFilter(t *testing.T) {
699705
api, err := GetAPI()
700706
if err != nil {
@@ -786,6 +792,7 @@ func notifHandler(ch chan error, fd ScmpFd, tests []notifTest) {
786792
func TestNotif(t *testing.T) {
787793
execInSubprocess(t, subprocessNotif)
788794
}
795+
789796
func subprocessNotif(t *testing.T) {
790797
// seccomp notification requires API level >= 6
791798
api, err := GetAPI()
@@ -953,6 +960,7 @@ L:
953960
func TestNotifUnsupported(t *testing.T) {
954961
execInSubprocess(t, subprocessNotifUnsupported)
955962
}
963+
956964
func subprocessNotifUnsupported(t *testing.T) {
957965
// seccomp notification requires API level >= 6
958966
api := 0

0 commit comments

Comments
 (0)