fix: go linter issue & not defined variables.

This commit is contained in:
Alexandre Pujol 2024-05-30 12:28:12 +01:00
parent 0f382a4d5d
commit bc216176a3
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
7 changed files with 14 additions and 19 deletions

View file

@ -20,7 +20,6 @@ var (
// Include
include1 = &Include{IsMagic: true, Path: "abstraction/base"}
include2 = &Include{IsMagic: false, Path: "abstraction/base"}
include3 = &Include{IfExists: true, IsMagic: true, Path: "abstraction/base"}
includeLocal1 = &Include{IfExists: true, IsMagic: true, Path: "local/foo"}
// Variable
@ -326,8 +325,7 @@ var (
}
// Link
link3LogStr = `apparmor="ALLOWED" operation="link" class="file" profile="dolphin" name="@{user_config_dirs}/kiorc" comm="dolphin" requested_mask="l" denied_mask="l" fsuid=1000 ouid=1000 target="@{user_config_dirs}/#3954"`
link1Log = map[string]string{
link1Log = map[string]string{
"apparmor": "ALLOWED",
"operation": "link",
"class": "file",

View file

@ -10,12 +10,6 @@ import (
"strings"
)
const (
tokALLOW = "allow"
tokAUDIT = "audit"
tokDENY = "deny"
)
type requirement map[string][]string
type constraint uint
@ -126,9 +120,9 @@ func (r Rules) Filter(filter Kind) Rules {
func (r Rules) GetVariables() []*Variable {
res := make([]*Variable, 0)
for _, rule := range r {
switch rule.(type) {
switch rule := rule.(type) {
case *Variable:
res = append(res, rule.(*Variable))
res = append(res, rule)
}
}
return res
@ -137,9 +131,9 @@ func (r Rules) GetVariables() []*Variable {
func (r Rules) GetIncludes() []*Include {
res := make([]*Include, 0)
for _, rule := range r {
switch rule.(type) {
switch rule := rule.(type) {
case *Include:
res = append(res, rule.(*Include))
res = append(res, rule)
}
}
return res