瀏覽代碼

profiles/seccomp: format code with gofumpt

Formatting the code with https://github.com/mvdan/gofumpt

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 3 年之前
父節點
當前提交
169fab5146
共有 3 個文件被更改,包括 4 次插入5 次删除
  1. 1 1
      profiles/seccomp/generate.go
  2. 1 1
      profiles/seccomp/kernel_linux.go
  3. 2 3
      profiles/seccomp/seccomp_test.go

+ 1 - 1
profiles/seccomp/generate.go

@@ -25,7 +25,7 @@ func main() {
 		panic(err)
 	}
 
-	if err := os.WriteFile(f, b, 0644); err != nil {
+	if err := os.WriteFile(f, b, 0o644); err != nil {
 		panic(err)
 	}
 }

+ 1 - 1
profiles/seccomp/kernel_linux.go

@@ -28,7 +28,7 @@ func getKernelVersion() (*KernelVersion, error) {
 
 // parseRelease parses a string and creates a KernelVersion based on it.
 func parseRelease(release string) (*KernelVersion, error) {
-	var version = KernelVersion{}
+	version := KernelVersion{}
 
 	// We're only make sure we get the "kernel" and "major revision". Sometimes we have
 	// 3.12.25-gentoo, but sometimes we just have 3.12-1-amd64.

+ 2 - 3
profiles/seccomp/seccomp_test.go

@@ -39,7 +39,6 @@ func TestLoadProfile(t *testing.T) {
 				}},
 			},
 			{
-
 				Names:  []string{"open"},
 				Action: specs.ActAllow,
 				Args:   []specs.LinuxSeccompArg{},
@@ -62,7 +61,7 @@ func TestLoadProfile(t *testing.T) {
 }
 
 func TestLoadProfileWithDefaultErrnoRet(t *testing.T) {
-	var profile = []byte(`{
+	profile := []byte(`{
 "defaultAction": "SCMP_ACT_ERRNO",
 "defaultErrnoRet": 6
 }`)
@@ -82,7 +81,7 @@ func TestLoadProfileWithDefaultErrnoRet(t *testing.T) {
 }
 
 func TestLoadProfileWithListenerPath(t *testing.T) {
-	var profile = []byte(`{
+	profile := []byte(`{
 "defaultAction": "SCMP_ACT_ERRNO",
 "listenerPath": "/var/run/seccompaget.sock",
 "listenerMetadata": "opaque-metadata"