Repository: kubernetes-sigs/security-profiles-operator
Pull request #856 (2022-03-22 10:50:15)

Enable revive and gomoddirectives linters


#### What type of PR is this?


/kind cleanup


#### What this PR does / why we need it:
Enabling both linters and fixing the report.
#### Which issue(s) this PR fixes:

<!--
*Automatically closes linked issue when PR is merged.
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.

Fixes #

or

None
-->
None
#### Does this PR have test?
None
<!--
If tests aren't applicable just write N/A.
-->

#### Special notes for your reviewer:
None
#### Does this PR introduce a user-facing change?

<!--
If no, just write "NONE" in the release-note block below.
If yes, a release note is required:
Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required".

For more information on release notes see: https://git.k8s.io/community/contributors/guide/release-notes.md
-->

```release-note
None
```


k8s-ci-robot: [APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *<a href="https://github.com/kubernetes-sigs/security-profiles-operator/pull/856#" title="Author self-approved">saschagrunert</a>*

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=kubernetes-sigs%2Fsecurity-profiles-operator).

The pull request process is described [here](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process)

<details >
Needs approval from an approver in each of these files:

- ~~[OWNERS](https://github.com/kubernetes-sigs/security-profiles-operator/blob/main/OWNERS)~~ [saschagrunert]

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":[]} -->
codecov-commenter: # [Codecov](https://codecov.io/gh/kubernetes-sigs/security-profiles-operator/pull/856?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) Report
> Merging [#856](https://codecov.io/gh/kubernetes-sigs/security-profiles-operator/pull/856?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) (42895da) into [main](https://codecov.io/gh/kubernetes-sigs/security-profiles-operator/commit/1cd7b17ec78376a39697e4a26d09411a849ffb42?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) (1cd7b17) will **decrease** coverage by `0.02%`.
> The diff coverage is `88.23%`.


```diff
@@            Coverage Diff             @@
##             main     #856      +/-   ##
==========================================
- Coverage   52.47%   52.45%   -0.03%     
==========================================
  Files          42       42              
  Lines        4278     4276       -2     
==========================================
- Hits         2245     2243       -2     
  Misses       1961     1961              
  Partials       72       72              
```

k8s-ci-robot: [APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *<a href="https://github.com/kubernetes-sigs/security-profiles-operator/pull/856#pullrequestreview-917538542" title="LGTM">jhrozek</a>*, *<a href="https://github.com/kubernetes-sigs/security-profiles-operator/pull/856#" title="Author self-approved">saschagrunert</a>*

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=kubernetes-sigs%2Fsecurity-profiles-operator).

The pull request process is described [here](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process)

<details >
Needs approval from an approver in each of these files:

- ~~[OWNERS](https://github.com/kubernetes-sigs/security-profiles-operator/blob/main/OWNERS)~~ [jhrozek,saschagrunert]

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":[]} -->

Patch:
diff --git a/.golangci.yml b/.golangci.yml
index 87e3fe63d..4bdfce5d0 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -43,6 +43,7 @@ linters:
     - goheader
     - goimports
     - gomnd
+    - gomoddirectives
     - gomodguard
     - goprintffuncname
     - gosec
@@ -65,6 +66,7 @@ linters:
     - prealloc
     - predeclared
     - promlinter
+    - revive
     - rowserrcheck
     - sqlclosecheck
     - staticcheck
@@ -87,11 +89,9 @@ linters:
     # - forbidigo
     # - funlen
     # - gochecknoglobals
-    # - gomoddirectives
     # - ireturn
     # - maintidx
     # - nlreturn
-    # - revive
     # - testpackage
     # - varnamelen
     # - wrapcheck
diff --git a/Makefile b/Makefile
index 0bf5581fb..4585d1dc1 100644
--- a/Makefile
+++ b/Makefile
@@ -205,6 +205,10 @@ update-mocks: ## Update all generated mocks
 		cat $$f >> tmp ;\
 		mv tmp $$f ;\
 	done
+	export BPF_IMPL=internal/pkg/daemon/bpfrecorder/bpfrecorderfakes/fake_impl.go && \
+	printf "//go:build linux && !no_bpf\n// +build linux,!no_bpf\n\n" | \
+		cat - $$BPF_IMPL | \
+		tee $$BPF_IMPL >/dev/null
 
 define go-build
 	$(GO) build -o $(BUILD_DIR)/$(shell basename $(1)) $(1)
@@ -289,7 +293,7 @@ update-bpf: $(BUILD_DIR) ## Build and update all generated BPF code with nix
 # Verification targets
 
 .PHONY: verify
-verify: verify-boilerplate verify-go-mod verify-go-lint verify-deployments verify-dependencies verify-toc ## Run all verification targets
+verify: verify-boilerplate verify-go-mod verify-go-lint verify-deployments verify-dependencies verify-toc verify-mocks ## Run all verification targets
 
 .PHONY: verify-boilerplate
 verify-boilerplate: $(BUILD_DIR)/verify_boilerplate.py ## Verify the boilerplate headers for all files
@@ -355,6 +359,10 @@ $(BUILD_DIR)/zeitgeist: $(BUILD_DIR)
 verify-toc: update-toc ## Verify the table of contents for the documentation
 	hack/tree-status
 
+.PHONY: verify-mocks
+verify-mocks: update-mocks ## Verify the content of the generated mocks
+	hack/tree-status
+
 .PHONY: verify-bpf
 verify-bpf: update-bpf ## Verify the generated bpf code
 	hack/tree-status
diff --git a/internal/pkg/atomic/bool.go b/internal/pkg/atomic/bool.go
index 0fb3e9daa..0a9023bcb 100644
--- a/internal/pkg/atomic/bool.go
+++ b/internal/pkg/atomic/bool.go
@@ -23,7 +23,7 @@ type Bool int32
 
 // Set can be used to set the atomic bool to a certain value.
 func (b *Bool) Set(yes bool) {
-	var value int32 = 0
+	var value int32
 	if yes {
 		value = 1
 	}
diff --git a/internal/pkg/daemon/enricher/audit.go b/internal/pkg/daemon/enricher/audit.go
index 61e4297c4..d4334555c 100644
--- a/internal/pkg/daemon/enricher/audit.go
+++ b/internal/pkg/daemon/enricher/audit.go
@@ -69,7 +69,7 @@ func extractSeccompLine(logLine string) *auditLine {
 	}
 
 	line := auditLine{}
-	line.type_ = auditTypeSeccomp
+	line.auditType = auditTypeSeccomp
 	line.timestampID = captures[2]
 	line.executable = captures[4]
 	if v, err := strconv.Atoi(captures[3]); err == nil {
@@ -94,7 +94,7 @@ func extractSelinuxLine(logLine string) *auditLine {
 	}
 
 	line := auditLine{}
-	line.type_ = auditTypeSelinux
+	line.auditType = auditTypeSelinux
 	line.timestampID = captures[1]
 	line.perm = captures[2]
 	if v, err := strconv.Atoi(captures[3]); err == nil {
diff --git a/internal/pkg/daemon/enricher/enricher.go b/internal/pkg/daemon/enricher/enricher.go
index 7956629c6..e664129db 100644
--- a/internal/pkg/daemon/enricher/enricher.go
+++ b/internal/pkg/daemon/enricher/enricher.go
@@ -364,13 +364,13 @@ func (e *Enricher) dispatchAuditLine(
 	auditLine *auditLine,
 	info *containerInfo,
 ) error {
-	switch auditLine.type_ {
+	switch auditLine.auditType {
 	case auditTypeSelinux:
 		e.dispatchSelinuxLine(metricsClient, nodeName, auditLine, info)
 	case auditTypeSeccomp:
 		e.dispatchSeccompLine(metricsClient, nodeName, auditLine, info)
 	default:
-		return errors.Errorf("unknown audit line type %s", auditLine.type_)
+		return errors.Errorf("unknown audit line type %s", auditLine.auditType)
 	}
 
 	return nil
@@ -384,7 +384,7 @@ func (e *Enricher) dispatchSelinuxLine(
 ) {
 	e.logger.Info("audit",
 		"timestamp", auditLine.timestampID,
-		"type", auditLine.type_,
+		"type", auditLine.auditType,
 		"profile", info.recordProfile,
 		"node", nodeName,
 		"namespace", info.namespace,
@@ -434,7 +434,7 @@ func (e *Enricher) dispatchSeccompLine(
 
 	e.logger.Info("audit",
 		"timestamp", auditLine.timestampID,
-		"type", auditLine.type_,
+		"type", auditLine.auditType,
 		"node", nodeName,
 		"namespace", info.namespace,
 		"pod", info.podName,
diff --git a/internal/pkg/daemon/enricher/types.go b/internal/pkg/daemon/enricher/types.go
index a20d44977..8a054fa5a 100644
--- a/internal/pkg/daemon/enricher/types.go
+++ b/internal/pkg/daemon/enricher/types.go
@@ -22,7 +22,7 @@ const (
 )
 
 type auditLine struct {
-	type_ string
+	auditType string
 
 	// common
 	processID   int
diff --git a/internal/pkg/daemon/profilerecorder/impl.go b/internal/pkg/daemon/profilerecorder/impl.go
index 8f2285d03..a3560ef90 100644
--- a/internal/pkg/daemon/profilerecorder/impl.go
+++ b/internal/pkg/daemon/profilerecorder/impl.go
@@ -56,11 +56,11 @@ type impl interface {
 	GetPod(context.Context, client.Client, client.ObjectKey) (*corev1.Pod, error)
 	GetSPOD(context.Context, client.Client) (*spodapi.SecurityProfilesOperatorDaemon, error)
 	DialBpfRecorder() (*grpc.ClientConn, context.CancelFunc, error)
-	StartBpfRecorder(bpfrecorderapi.BpfRecorderClient, context.Context) error
-	StopBpfRecorder(bpfrecorderapi.BpfRecorderClient, context.Context) error
+	StartBpfRecorder(context.Context, bpfrecorderapi.BpfRecorderClient) error
+	StopBpfRecorder(context.Context, bpfrecorderapi.BpfRecorderClient) error
 	SyscallsForProfile(
-		bpfrecorderapi.BpfRecorderClient,
 		context.Context,
+		bpfrecorderapi.BpfRecorderClient,
 		*bpfrecorderapi.ProfileRequest,
 	) (*bpfrecorderapi.SyscallsResponse, error)
 	CreateOrUpdate(
@@ -69,16 +69,16 @@ type impl interface {
 	GoArchToSeccompArch(string) (seccomp.Arch, error)
 	ReadFile(string) ([]byte, error)
 	Syscalls(
-		enricherapi.EnricherClient, context.Context, *enricherapi.SyscallsRequest,
+		context.Context, enricherapi.EnricherClient, *enricherapi.SyscallsRequest,
 	) (*enricherapi.SyscallsResponse, error)
 	ResetSyscalls(
-		enricherapi.EnricherClient, context.Context, *enricherapi.SyscallsRequest,
+		context.Context, enricherapi.EnricherClient, *enricherapi.SyscallsRequest,
 	) error
 	Avcs(
-		enricherapi.EnricherClient, context.Context, *enricherapi.AvcRequest,
+		context.Context, enricherapi.EnricherClient, *enricherapi.AvcRequest,
 	) (*enricherapi.AvcResponse, error)
 	ResetAvcs(
-		enricherapi.EnricherClient, context.Context, *enricherapi.AvcRequest,
+		context.Context, enricherapi.EnricherClient, *enricherapi.AvcRequest,
 	) error
 	DialEnricher() (*grpc.ClientConn, context.CancelFunc, error)
 }
@@ -139,22 +139,22 @@ func (*defaultImpl) DialBpfRecorder() (*grpc.ClientConn, context.CancelFunc, err
 }
 
 func (*defaultImpl) StartBpfRecorder(
-	c bpfrecorderapi.BpfRecorderClient, ctx context.Context,
+	ctx context.Context, c bpfrecorderapi.BpfRecorderClient,
 ) error {
 	_, err := c.Start(ctx, &bpfrecorderapi.EmptyRequest{})
 	return err
 }
 
 func (*defaultImpl) StopBpfRecorder(
-	c bpfrecorderapi.BpfRecorderClient, ctx context.Context,
+	ctx context.Context, c bpfrecorderapi.BpfRecorderClient,
 ) error {
 	_, err := c.Stop(ctx, &bpfrecorderapi.EmptyRequest{})
 	return err
 }
 
 func (*defaultImpl) SyscallsForProfile(
-	c bpfrecorderapi.BpfRecorderClient,
 	ctx context.Context,
+	c bpfrecorderapi.BpfRecorderClient,
 	req *bpfrecorderapi.ProfileRequest,
 ) (*bpfrecorderapi.SyscallsResponse, error) {
 	return c.SyscallsForProfile(ctx, req)
@@ -178,26 +178,26 @@ func (*defaultImpl) ReadFile(filename string) ([]byte, error) {
 }
 
 func (*defaultImpl) Syscalls(
-	c enricherapi.EnricherClient, ctx context.Context, in *enricherapi.SyscallsRequest,
+	ctx context.Context, c enricherapi.EnricherClient, in *enricherapi.SyscallsRequest,
 ) (*enricherapi.SyscallsResponse, error) {
 	return c.Syscalls(ctx, in)
 }
 
 func (*defaultImpl) ResetSyscalls(
-	c enricherapi.EnricherClient, ctx context.Context, in *enricherapi.SyscallsRequest,
+	ctx context.Context, c enricherapi.EnricherClient, in *enricherapi.SyscallsRequest,
 ) error {
 	_, err := c.ResetSyscalls(ctx, in)
 	return err
 }
 
 func (*defaultImpl) Avcs(
-	c enricherapi.EnricherClient, ctx context.Context, in *enricherapi.AvcRequest,
+	ctx context.Context, c enricherapi.EnricherClient, in *enricherapi.AvcRequest,
 ) (*enricherapi.AvcResponse, error) {
 	return c.Avcs(ctx, in)
 }
 
 func (*defaultImpl) ResetAvcs(
-	c enricherapi.EnricherClient, ctx context.Context, in *enricherapi.AvcRequest,
+	ctx context.Context, c enricherapi.EnricherClient, in *enricherapi.AvcRequest,
 ) error {
 	_, err := c.ResetAvcs(ctx, in)
 	return err
diff --git a/internal/pkg/daemon/profilerecorder/profilerecorder.go b/internal/pkg/daemon/profilerecorder/profilerecorder.go
index a13147566..42674e6d3 100644
--- a/internal/pkg/daemon/profilerecorder/profilerecorder.go
+++ b/internal/pkg/daemon/profilerecorder/profilerecorder.go
@@ -210,11 +210,11 @@ func (r *RecorderReconciler) Reconcile(_ context.Context, req reconcile.Request)
 		if kerrors.IsNotFound(err) {
 			err = r.collectProfile(ctx, req.NamespacedName)
 			return reconcile.Result{}, errors.Wrap(err, "collect profile for removed pod")
-		} else {
-			// Returning an error means we will be requeued implicitly.
-			logger.Error(err, "Error reading pod")
-			return reconcile.Result{}, errors.Wrap(err, "cannot get pod")
 		}
+
+		// Returning an error means we will be requeued implicitly.
+		logger.Error(err, "Error reading pod")
+		return reconcile.Result{}, errors.Wrap(err, "cannot get pod")
 	}
 
 	if pod.Status.Phase == corev1.PodPending {
@@ -322,7 +322,7 @@ func (r *RecorderReconciler) startBpfRecorder() error {
 	ctx, cancel := context.WithTimeout(context.Background(), reconcileTimeout)
 	defer cancel()
 	r.log.Info("Starting BPF recorder on node")
-	return r.StartBpfRecorder(recorderClient, ctx)
+	return r.StartBpfRecorder(ctx, recorderClient)
 }
 
 func (r *RecorderReconciler) stopBpfRecorder() error {
@@ -335,7 +335,7 @@ func (r *RecorderReconciler) stopBpfRecorder() error {
 	ctx, cancel := context.WithTimeout(context.Background(), reconcileTimeout)
 	defer cancel()
 	r.log.Info("Stopping BPF recorder on node")
-	return r.StopBpfRecorder(recorderClient, ctx)
+	return r.StopBpfRecorder(ctx, recorderClient)
 }
 
 func (r *RecorderReconciler) collectProfile(
@@ -494,7 +494,7 @@ func (r *RecorderReconciler) collectLogSeccompProfile(
 ) error {
 	// Retrieve the syscalls for the recording
 	request := &enricherapi.SyscallsRequest{Profile: profileID}
-	response, err := r.Syscalls(enricherClient, ctx, request)
+	response, err := r.Syscalls(ctx, enricherClient, request)
 	if err != nil {
 		return errors.Wrapf(
 			err, "retrieve syscalls for profile %s", profileID,
@@ -542,7 +542,7 @@ func (r *RecorderReconciler) collectLogSeccompProfile(
 	)
 
 	// Reset the syscalls for further recordings
-	if err := r.ResetSyscalls(enricherClient, ctx, request); err != nil {
+	if err := r.ResetSyscalls(ctx, enricherClient, request); err != nil {
 		return errors.Wrapf(
 			err, "reset syscalls for profile %s", profileID,
 		)
@@ -560,7 +560,7 @@ func (r *RecorderReconciler) collectLogSelinuxProfile(
 ) error {
 	// Retrieve the syscalls for the recording
 	request := &enricherapi.AvcRequest{Profile: profileID}
-	response, err := r.Avcs(enricherClient, ctx, request)
+	response, err := r.Avcs(ctx, enricherClient, request)
 	if err != nil {
 		return errors.Wrapf(
 			err, "retrieve avcs for profile %s", profileID,
@@ -610,7 +610,7 @@ func (r *RecorderReconciler) collectLogSelinuxProfile(
 	)
 
 	// Reset the selinuxprofile for further recordings
-	if err := r.ResetAvcs(enricherClient, ctx, request); err != nil {
+	if err := r.ResetAvcs(ctx, enricherClient, request); err != nil {
 		return errors.Wrapf(
 			err, "reset selinuxprofile for profile %s", profileName,
 		)
@@ -651,7 +651,7 @@ func (r *RecorderReconciler) collectBpfProfiles(
 	for _, profile := range profiles {
 		r.log.Info("Collecting BPF profile", "name", profile.name, "kind", profile.kind)
 		response, err := r.SyscallsForProfile(
-			recorderClient, ctx, &bpfrecorderapi.ProfileRequest{Name: profile.name},
+			ctx, recorderClient, &bpfrecorderapi.ProfileRequest{Name: profile.name},
 		)
 		if err != nil {
 			// PID was not found for this profile, this might be an init container
diff --git a/internal/pkg/daemon/profilerecorder/profilerecorderfakes/fake_impl.go b/internal/pkg/daemon/profilerecorder/profilerecorderfakes/fake_impl.go
index 7abd2044b..6681d7bed 100644
--- a/internal/pkg/daemon/profilerecorder/profilerecorderfakes/fake_impl.go
+++ b/internal/pkg/daemon/profilerecorder/profilerecorderfakes/fake_impl.go
@@ -37,11 +37,11 @@ import (
 )
 
 type FakeImpl struct {
-	AvcsStub        func(api_enricher.EnricherClient, context.Context, *api_enricher.AvcRequest) (*api_enricher.AvcResponse, error)
+	AvcsStub        func(context.Context, api_enricher.EnricherClient, *api_enricher.AvcRequest) (*api_enricher.AvcResponse, error)
 	avcsMutex       sync.RWMutex
 	avcsArgsForCall []struct {
-		arg1 api_enricher.EnricherClient
-		arg2 context.Context
+		arg1 context.Context
+		arg2 api_enricher.EnricherClient
 		arg3 *api_enricher.AvcRequest
 	}
 	avcsReturns struct {
@@ -215,11 +215,11 @@ type FakeImpl struct {
 		result1 []byte
 		result2 error
 	}
-	ResetAvcsStub        func(api_enricher.EnricherClient, context.Context, *api_enricher.AvcRequest) error
+	ResetAvcsStub        func(context.Context, api_enricher.EnricherClient, *api_enricher.AvcRequest) error
 	resetAvcsMutex       sync.RWMutex
 	resetAvcsArgsForCall []struct {
-		arg1 api_enricher.EnricherClient
-		arg2 context.Context
+		arg1 context.Context
+		arg2 api_enricher.EnricherClient
 		arg3 *api_enricher.AvcRequest
 	}
 	resetAvcsReturns struct {
@@ -228,11 +228,11 @@ type FakeImpl struct {
 	resetAvcsReturnsOnCall map[int]struct {
 		result1 error
 	}
-	ResetSyscallsStub        func(api_enricher.EnricherClient, context.Context, *api_enricher.SyscallsRequest) error
+	ResetSyscallsStub        func(context.Context, api_enricher.EnricherClient, *api_enricher.SyscallsRequest) error
 	resetSyscallsMutex       sync.RWMutex
 	resetSyscallsArgsForCall []struct {
-		arg1 api_enricher.EnricherClient
-		arg2 context.Context
+		arg1 context.Context
+		arg2 api_enricher.EnricherClient
 		arg3 *api_enricher.SyscallsRequest
 	}
 	resetSyscallsReturns struct {
@@ -241,11 +241,11 @@ type FakeImpl struct {
 	resetSyscallsReturnsOnCall map[int]struct {
 		result1 error
 	}
-	StartBpfRecorderStub        func(api_bpfrecorder.BpfRecorderClient, context.Context) error
+	StartBpfRecorderStub        func(context.Context, api_bpfrecorder.BpfRecorderClient) error
 	startBpfRecorderMutex       sync.RWMutex
 	startBpfRecorderArgsForCall []struct {
-		arg1 api_bpfrecorder.BpfRecorderClient
-		arg2 context.Context
+		arg1 context.Context
+		arg2 api_bpfrecorder.BpfRecorderClient
 	}
 	startBpfRecorderReturns struct {
 		result1 error
@@ -253,11 +253,11 @@ type FakeImpl struct {
 	startBpfRecorderReturnsOnCall map[int]struct {
 		result1 error
 	}
-	StopBpfRecorderStub        func(api_bpfrecorder.BpfRecorderClient, context.Context) error
+	StopBpfRecorderStub        func(context.Context, api_bpfrecorder.BpfRecorderClient) error
 	stopBpfRecorderMutex       sync.RWMutex
 	stopBpfRecorderArgsForCall []struct {
-		arg1 api_bpfrecorder.BpfRecorderClient
-		arg2 context.Context
+		arg1 context.Context
+		arg2 api_bpfrecorder.BpfRecorderClient
 	}
 	stopBpfRecorderReturns struct {
 		result1 error
@@ -265,11 +265,11 @@ type FakeImpl struct {
 	stopBpfRecorderReturnsOnCall map[int]struct {
 		result1 error
 	}
-	SyscallsStub        func(api_enricher.EnricherClient, context.Context, *api_enricher.SyscallsRequest) (*api_enricher.SyscallsResponse, error)
+	SyscallsStub        func(context.Context, api_enricher.EnricherClient, *api_enricher.SyscallsRequest) (*api_enricher.SyscallsResponse, error)
 	syscallsMutex       sync.RWMutex
 	syscallsArgsForCall []struct {
-		arg1 api_enricher.EnricherClient
-		arg2 context.Context
+		arg1 context.Context
+		arg2 api_enricher.EnricherClient
 		arg3 *api_enricher.SyscallsRequest
 	}
 	syscallsReturns struct {
@@ -280,11 +280,11 @@ type FakeImpl struct {
 		result1 *api_enricher.SyscallsResponse
 		result2 error
 	}
-	SyscallsForProfileStub        func(api_bpfrecorder.BpfRecorderClient, context.Context, *api_bpfrecorder.ProfileRequest) (*api_bpfrecorder.SyscallsResponse, error)
+	SyscallsForProfileStub        func(context.Context, api_bpfrecorder.BpfRecorderClient, *api_bpfrecorder.ProfileRequest) (*api_bpfrecorder.SyscallsResponse, error)
 	syscallsForProfileMutex       sync.RWMutex
 	syscallsForProfileArgsForCall []struct {
-		arg1 api_bpfrecorder.BpfRecorderClient
-		arg2 context.Context
+		arg1 context.Context
+		arg2 api_bpfrecorder.BpfRecorderClient
 		arg3 *api_bpfrecorder.ProfileRequest
 	}
 	syscallsForProfileReturns struct {
@@ -299,12 +299,12 @@ type FakeImpl struct {
 	invocationsMutex sync.RWMutex
 }
 
-func (fake *FakeImpl) Avcs(arg1 api_enricher.EnricherClient, arg2 context.Context, arg3 *api_enricher.AvcRequest) (*api_enricher.AvcResponse, error) {
+func (fake *FakeImpl) Avcs(arg1 context.Context, arg2 api_enricher.EnricherClient, arg3 *api_enricher.AvcRequest) (*api_enricher.AvcResponse, error) {
 	fake.avcsMutex.Lock()
 	ret, specificReturn := fake.avcsReturnsOnCall[len(fake.avcsArgsForCall)]
 	fake.avcsArgsForCall = append(fake.avcsArgsForCall, struct {
-		arg1 api_enricher.EnricherClient
-		arg2 context.Context
+		arg1 context.Context
+		arg2 api_enricher.EnricherClient
 		arg3 *api_enricher.AvcRequest
 	}{arg1, arg2, arg3})
 	stub := fake.AvcsStub
@@ -326,13 +326,13 @@ func (fake *FakeImpl) AvcsCallCount() int {
 	return len(fake.avcsArgsForCall)
 }
 
-func (fake *FakeImpl) AvcsCalls(stub func(api_enricher.EnricherClient, context.Context, *api_enricher.AvcRequest) (*api_enricher.AvcResponse, error)) {
+func (fake *FakeImpl) AvcsCalls(stub func(context.Context, api_enricher.EnricherClient, *api_enricher.AvcRequest) (*api_enricher.AvcResponse, error)) {
 	fake.avcsMutex.Lock()
 	defer fake.avcsMutex.Unlock()
 	fake.AvcsStub = stub
 }
 
-func (fake *FakeImpl) AvcsArgsForCall(i int) (api_enricher.EnricherClient, context.Context, *api_enricher.AvcRequest) {
+func (fake *FakeImpl) AvcsArgsForCall(i int) (context.Context, api_enricher.EnricherClient, *api_enricher.AvcRequest) {
 	fake.avcsMutex.RLock()
 	defer fake.avcsMutex.RUnlock()
 	argsForCall := fake.avcsArgsForCall[i]
@@ -1124,12 +1124,12 @@ func (fake *FakeImpl) ReadFileReturnsOnCall(i int, result1 []byte, result2 error
 	}{result1, result2}
 }
 
-func (fake *FakeImpl) ResetAvcs(arg1 api_enricher.EnricherClient, arg2 context.Context, arg3 *api_enricher.AvcRequest) error {
+func (fake *FakeImpl) ResetAvcs(arg1 context.Context, arg2 api_enricher.EnricherClient, arg3 *api_enricher.AvcRequest) error {
 	fake.resetAvcsMutex.Lock()
 	ret, specificReturn := fake.resetAvcsReturnsOnCall[len(fake.resetAvcsArgsForCall)]
 	fake.resetAvcsArgsForCall = append(fake.resetAvcsArgsForCall, struct {
-		arg1 api_enricher.EnricherClient
-		arg2 context.Context
+		arg1 context.Context
+		arg2 api_enricher.EnricherClient
 		arg3 *api_enricher.AvcRequest
 	}{arg1, arg2, arg3})
 	stub := fake.ResetAvcsStub
@@ -1151,13 +1151,13 @@ func (fake *FakeImpl) ResetAvcsCallCount() int {
 	return len(fake.resetAvcsArgsForCall)
 }
 
-func (fake *FakeImpl) ResetAvcsCalls(stub func(api_enricher.EnricherClient, context.Context, *api_enricher.AvcRequest) error) {
+func (fake *FakeImpl) ResetAvcsCalls(stub func(context.Context, api_enricher.EnricherClient, *api_enricher.AvcRequest) error) {
 	fake.resetAvcsMutex.Lock()
 	defer fake.resetAvcsMutex.Unlock()
 	fake.ResetAvcsStub = stub
 }
 
-func (fake *FakeImpl) ResetAvcsArgsForCall(i int) (api_enricher.EnricherClient, context.Context, *api_enricher.AvcRequest) {
+func (fake *FakeImpl) ResetAvcsArgsForCall(i int) (context.Context, api_enricher.EnricherClient, *api_enricher.AvcRequest) {
 	fake.resetAvcsMutex.RLock()
 	defer fake.resetAvcsMutex.RUnlock()
 	argsForCall := fake.resetAvcsArgsForCall[i]
@@ -1187,12 +1187,12 @@ func (fake *FakeImpl) ResetAvcsReturnsOnCall(i int, result1 error) {
 	}{result1}
 }
 
-func (fake *FakeImpl) ResetSyscalls(arg1 api_enricher.EnricherClient, arg2 context.Context, arg3 *api_enricher.SyscallsRequest) error {
+func (fake *FakeImpl) ResetSyscalls(arg1 context.Context, arg2 api_enricher.EnricherClient, arg3 *api_enricher.SyscallsRequest) error {
 	fake.resetSyscallsMutex.Lock()
 	ret, specificReturn := fake.resetSyscallsReturnsOnCall[len(fake.resetSyscallsArgsForCall)]
 	fake.resetSyscallsArgsForCall = append(fake.resetSyscallsArgsForCall, struct {
-		arg1 api_enricher.EnricherClient
-		arg2 context.Context
+		arg1 context.Context
+		arg2 api_enricher.EnricherClient
 		arg3 *api_enricher.SyscallsRequest
 	}{arg1, arg2, arg3})
 	stub := fake.ResetSyscallsStub
@@ -1214,13 +1214,13 @@ func (fake *FakeImpl) ResetSyscallsCallCount() int {
 	return len(fake.resetSyscallsArgsForCall)
 }
 
-func (fake *FakeImpl) ResetSyscallsCalls(stub func(api_enricher.EnricherClient, context.Context, *api_enricher.SyscallsRequest) error) {
+func (fake *FakeImpl) ResetSyscallsCalls(stub func(context.Context, api_enricher.EnricherClient, *api_enricher.SyscallsRequest) error) {
 	fake.resetSyscallsMutex.Lock()
 	defer fake.resetSyscallsMutex.Unlock()
 	fake.ResetSyscallsStub = stub
 }
 
-func (fake *FakeImpl) ResetSyscallsArgsForCall(i int) (api_enricher.EnricherClient, context.Context, *api_enricher.SyscallsRequest) {
+func (fake *FakeImpl) ResetSyscallsArgsForCall(i int) (context.Context, api_enricher.EnricherClient, *api_enricher.SyscallsRequest) {
 	fake.resetSyscallsMutex.RLock()
 	defer fake.resetSyscallsMutex.RUnlock()
 	argsForCall := fake.resetSyscallsArgsForCall[i]
@@ -1250,12 +1250,12 @@ func (fake *FakeImpl) ResetSyscallsReturnsOnCall(i int, result1 error) {
 	}{result1}
 }
 
-func (fake *FakeImpl) StartBpfRecorder(arg1 api_bpfrecorder.BpfRecorderClient, arg2 context.Context) error {
+func (fake *FakeImpl) StartBpfRecorder(arg1 context.Context, arg2 api_bpfrecorder.BpfRecorderClient) error {
 	fake.startBpfRecorderMutex.Lock()
 	ret, specificReturn := fake.startBpfRecorderReturnsOnCall[len(fake.startBpfRecorderArgsForCall)]
 	fake.startBpfRecorderArgsForCall = append(fake.startBpfRecorderArgsForCall, struct {
-		arg1 api_bpfrecorder.BpfRecorderClient
-		arg2 context.Context
+		arg1 context.Context
+		arg2 api_bpfrecorder.BpfRecorderClient
 	}{arg1, arg2})
 	stub := fake.StartBpfRecorderStub
 	fakeReturns := fake.startBpfRecorderReturns
@@ -1276,13 +1276,13 @@ func (fake *FakeImpl) StartBpfRecorderCallCount() int {
 	return len(fake.startBpfRecorderArgsForCall)
 }
 
-func (fake *FakeImpl) StartBpfRecorderCalls(stub func(api_bpfrecorder.BpfRecorderClient, context.Context) error) {
+func (fake *FakeImpl) StartBpfRecorderCalls(stub func(context.Context, api_bpfrecorder.BpfRecorderClient) error) {
 	fake.startBpfRecorderMutex.Lock()
 	defer fake.startBpfRecorderMutex.Unlock()
 	fake.StartBpfRecorderStub = stub
 }
 
-func (fake *FakeImpl) StartBpfRecorderArgsForCall(i int) (api_bpfrecorder.BpfRecorderClient, context.Context) {
+func (fake *FakeImpl) StartBpfRecorderArgsForCall(i int) (context.Context, api_bpfrecorder.BpfRecorderClient) {
 	fake.startBpfRecorderMutex.RLock()
 	defer fake.startBpfRecorderMutex.RUnlock()
 	argsForCall := fake.startBpfRecorderArgsForCall[i]
@@ -1312,12 +1312,12 @@ func (fake *FakeImpl) StartBpfRecorderReturnsOnCall(i int, result1 error) {
 	}{result1}
 }
 
-func (fake *FakeImpl) StopBpfRecorder(arg1 api_bpfrecorder.BpfRecorderClient, arg2 context.Context) error {
+func (fake *FakeImpl) StopBpfRecorder(arg1 context.Context, arg2 api_bpfrecorder.BpfRecorderClient) error {
 	fake.stopBpfRecorderMutex.Lock()
 	ret, specificReturn := fake.stopBpfRecorderReturnsOnCall[len(fake.stopBpfRecorderArgsForCall)]
 	fake.stopBpfRecorderArgsForCall = append(fake.stopBpfRecorderArgsForCall, struct {
-		arg1 api_bpfrecorder.BpfRecorderClient
-		arg2 context.Context
+		arg1 context.Context
+		arg2 api_bpfrecorder.BpfRecorderClient
 	}{arg1, arg2})
 	stub := fake.StopBpfRecorderStub
 	fakeReturns := fake.stopBpfRecorderReturns
@@ -1338,13 +1338,13 @@ func (fake *FakeImpl) StopBpfRecorderCallCount() int {
 	return len(fake.stopBpfRecorderArgsForCall)
 }
 
-func (fake *FakeImpl) StopBpfRecorderCalls(stub func(api_bpfrecorder.BpfRecorderClient, context.Context) error) {
+func (fake *FakeImpl) StopBpfRecorderCalls(stub func(context.Context, api_bpfrecorder.BpfRecorderClient) error) {
 	fake.stopBpfRecorderMutex.Lock()
 	defer fake.stopBpfRecorderMutex.Unlock()
 	fake.StopBpfRecorderStub = stub
 }
 
-func (fake *FakeImpl) StopBpfRecorderArgsForCall(i int) (api_bpfrecorder.BpfRecorderClient, context.Context) {
+func (fake *FakeImpl) StopBpfRecorderArgsForCall(i int) (context.Context, api_bpfrecorder.BpfRecorderClient) {
 	fake.stopBpfRecorderMutex.RLock()
 	defer fake.stopBpfRecorderMutex.RUnlock()
 	argsForCall := fake.stopBpfRecorderArgsForCall[i]
@@ -1374,12 +1374,12 @@ func (fake *FakeImpl) StopBpfRecorderReturnsOnCall(i int, result1 error) {
 	}{result1}
 }
 
-func (fake *FakeImpl) Syscalls(arg1 api_enricher.EnricherClient, arg2 context.Context, arg3 *api_enricher.SyscallsRequest) (*api_enricher.SyscallsResponse, error) {
+func (fake *FakeImpl) Syscalls(arg1 context.Context, arg2 api_enricher.EnricherClient, arg3 *api_enricher.SyscallsRequest) (*api_enricher.SyscallsResponse, error) {
 	fake.syscallsMutex.Lock()
 	ret, specificReturn := fake.syscallsReturnsOnCall[len(fake.syscallsArgsForCall)]
 	fake.syscallsArgsForCall = append(fake.syscallsArgsForCall, struct {
-		arg1 api_enricher.EnricherClient
-		arg2 context.Context
+		arg1 context.Context
+		arg2 api_enricher.EnricherClient
 		arg3 *api_enricher.SyscallsRequest
 	}{arg1, arg2, arg3})
 	stub := fake.SyscallsStub
@@ -1401,13 +1401,13 @@ func (fake *FakeImpl) SyscallsCallCount() int {
 	return len(fake.syscallsArgsForCall)
 }
 
-func (fake *FakeImpl) SyscallsCalls(stub func(api_enricher.EnricherClient, context.Context, *api_enricher.SyscallsRequest) (*api_enricher.SyscallsResponse, error)) {
+func (fake *FakeImpl) SyscallsCalls(stub func(context.Context, api_enricher.EnricherClient, *api_enricher.SyscallsRequest) (*api_enricher.SyscallsResponse, error)) {
 	fake.syscallsMutex.Lock()
 	defer fake.syscallsMutex.Unlock()
 	fake.SyscallsStub = stub
 }
 
-func (fake *FakeImpl) SyscallsArgsForCall(i int) (api_enricher.EnricherClient, context.Context, *api_enricher.SyscallsRequest) {
+func (fake *FakeImpl) SyscallsArgsForCall(i int) (context.Context, api_enricher.EnricherClient, *api_enricher.SyscallsRequest) {
 	fake.syscallsMutex.RLock()
 	defer fake.syscallsMutex.RUnlock()
 	argsForCall := fake.syscallsArgsForCall[i]
@@ -1440,12 +1440,12 @@ func (fake *FakeImpl) SyscallsReturnsOnCall(i int, result1 *api_enricher.Syscall
 	}{result1, result2}
 }
 
-func (fake *FakeImpl) SyscallsForProfile(arg1 api_bpfrecorder.BpfRecorderClient, arg2 context.Context, arg3 *api_bpfrecorder.ProfileRequest) (*api_bpfrecorder.SyscallsResponse, error) {
+func (fake *FakeImpl) SyscallsForProfile(arg1 context.Context, arg2 api_bpfrecorder.BpfRecorderClient, arg3 *api_bpfrecorder.ProfileRequest) (*api_bpfrecorder.SyscallsResponse, error) {
 	fake.syscallsForProfileMutex.Lock()
 	ret, specificReturn := fake.syscallsForProfileReturnsOnCall[len(fake.syscallsForProfileArgsForCall)]
 	fake.syscallsForProfileArgsForCall = append(fake.syscallsForProfileArgsForCall, struct {
-		arg1 api_bpfrecorder.BpfRecorderClient
-		arg2 context.Context
+		arg1 context.Context
+		arg2 api_bpfrecorder.BpfRecorderClient
 		arg3 *api_bpfrecorder.ProfileRequest
 	}{arg1, arg2, arg3})
 	stub := fake.SyscallsForProfileStub
@@ -1467,13 +1467,13 @@ func (fake *FakeImpl) SyscallsForProfileCallCount() int {
 	return len(fake.syscallsForProfileArgsForCall)
 }
 
-func (fake *FakeImpl) SyscallsForProfileCalls(stub func(api_bpfrecorder.BpfRecorderClient, context.Context, *api_bpfrecorder.ProfileRequest) (*api_bpfrecorder.SyscallsResponse, error)) {
+func (fake *FakeImpl) SyscallsForProfileCalls(stub func(context.Context, api_bpfrecorder.BpfRecorderClient, *api_bpfrecorder.ProfileRequest) (*api_bpfrecorder.SyscallsResponse, error)) {
 	fake.syscallsForProfileMutex.Lock()
 	defer fake.syscallsForProfileMutex.Unlock()
 	fake.SyscallsForProfileStub = stub
 }
 
-func (fake *FakeImpl) SyscallsForProfileArgsForCall(i int) (api_bpfrecorder.BpfRecorderClient, context.Context, *api_bpfrecorder.ProfileRequest) {
+func (fake *FakeImpl) SyscallsForProfileArgsForCall(i int) (context.Context, api_bpfrecorder.BpfRecorderClient, *api_bpfrecorder.ProfileRequest) {
 	fake.syscallsForProfileMutex.RLock()
 	defer fake.syscallsForProfileMutex.RUnlock()
 	argsForCall := fake.syscallsForProfileArgsForCall[i]
diff --git a/internal/pkg/manager/spod/bindata/spod.go b/internal/pkg/manager/spod/bindata/spod.go
index 077b5d5e6..74ba1da58 100644
--- a/internal/pkg/manager/spod/bindata/spod.go
+++ b/internal/pkg/manager/spod/bindata/spod.go
@@ -31,9 +31,9 @@ import (
 )
 
 var (
+	userRoot                  int64
 	falsely                         = false
 	truly                           = true
-	userRoot                  int64 = 0
 	userRootless                    = int64(config.UserRootless)
 	hostPathDirectory               = corev1.HostPathDirectory
 	hostPathDirectoryOrCreate       = corev1.HostPathDirectoryOrCreate
diff --git a/internal/pkg/manager/spod/spod_controller.go b/internal/pkg/manager/spod/spod_controller.go
index af2f29422..6707e2f3d 100644
--- a/internal/pkg/manager/spod/spod_controller.go
+++ b/internal/pkg/manager/spod/spod_controller.go
@@ -519,7 +519,7 @@ func (r *ReconcileSPOd) getConfiguredSPOd(
 	// AppArmor parameters
 	if cfg.Spec.EnableAppArmor {
 		falsely, truly := false, true
-		var userRoot int64 = 0
+		var userRoot int64
 		// a more privileged mode is required when apparmor is enabled
 		// TODO: review security model and provide a dynamic approach that can be case specific
 		templateSpec.Containers[bindata.ContainerIDDaemon].SecurityContext = &corev1.SecurityContext{


Test patch:
diff --git a/internal/pkg/daemon/enricher/audit_test.go b/internal/pkg/daemon/enricher/audit_test.go
index 43d2b3ccf..bd66fa60f 100644
--- a/internal/pkg/daemon/enricher/audit_test.go
+++ b/internal/pkg/daemon/enricher/audit_test.go
@@ -88,7 +88,7 @@ func Test_extractAuditLine(t *testing.T) {
 			// nolint:lll // no need to wrap
 			`audit: type=1326 audit(1612299677.115:549067): auid=4294967295 uid=0 gid=0 ses=4294967295 pid=3109464 comm="sh" exe="/bin/busybox" sig=0 arch=c000003e syscall=0 compat=0 ip=0x7fce771ae923 code=0x7ffc0000`,
 			&auditLine{
-				type_:        "seccomp",
+				auditType:    "seccomp",
 				timestampID:  "1612299677.115:549067",
 				systemCallID: 0,
 				processID:    3109464,
@@ -101,7 +101,7 @@ func Test_extractAuditLine(t *testing.T) {
 			// nolint:lll // no need to wrap
 			`type=SECCOMP msg=audit(1613596317.899:6461): auid=4294967295 uid=0 gid=0 ses=4294967295 subj=system_u:system_r:spc_t:s0:c284,c594 pid=2039886 comm="ls" exe="/bin/ls" sig=0 arch=c000003e syscall=3 compat=0 ip=0x7f62dce3d4c7 code=0x7ffc0000AUID="unset" UID="root" GID="root" ARCH=x86_64 SYSCALL=close`,
 			&auditLine{
-				type_:        "seccomp",
+				auditType:    "seccomp",
 				timestampID:  "1613596317.899:6461",
 				systemCallID: 3,
 				processID:    2039886,
@@ -114,7 +114,7 @@ func Test_extractAuditLine(t *testing.T) {
 			// nolint:lll // no need to wrap
 			`type=AVC msg=audit(1613173578.156:2945): avc:  denied  { read } for  pid=75593 comm="security-profil" name="token" dev="tmpfs" ino=612459 scontext=system_u:system_r:container_t:s0:c4,c808 tcontext=system_u:object_r:var_lib_t:s0 tclass=lnk_file permissive=0`,
 			&auditLine{
-				type_:        "selinux",
+				auditType:    "selinux",
 				timestampID:  "1613173578.156:2945",
 				systemCallID: 0,
 				processID:    75593,
diff --git a/internal/pkg/daemon/enricher/enricher_test.go b/internal/pkg/daemon/enricher/enricher_test.go
index 0c046d299..940b0a4b4 100644
--- a/internal/pkg/daemon/enricher/enricher_test.go
+++ b/internal/pkg/daemon/enricher/enricher_test.go
@@ -300,7 +300,7 @@ func TestRun(t *testing.T) {
 				mock.GetFromBacklogReturns(
 					[]*auditLine{
 						{
-							type_:        "selinux",
+							auditType:    "selinux",
 							timestampID:  "1613173578.156:2945",
 							systemCallID: 0,
 							processID:    75593,