mirror of
https://github.com/roddhjav/apparmor.d.git
synced 2024-11-15 07:54:17 +01:00
chore(aa): cosmetic.
This commit is contained in:
parent
4282fb336e
commit
16f30007e7
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
package aa
|
package aa
|
||||||
|
|
||||||
const PIVOTROOT = "pivot_root"
|
const PIVOTROOT Kind = "pivot_root"
|
||||||
|
|
||||||
type PivotRoot struct {
|
type PivotRoot struct {
|
||||||
RuleBase
|
RuleBase
|
||||||
|
@ -7,7 +7,6 @@ package aa
|
|||||||
import (
|
import (
|
||||||
"embed"
|
"embed"
|
||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
|
||||||
"strings"
|
"strings"
|
||||||
"text/template"
|
"text/template"
|
||||||
)
|
)
|
||||||
@ -176,12 +175,12 @@ func generateRequirementsWeights(requirements map[Kind]requirement) map[Kind]map
|
|||||||
}
|
}
|
||||||
|
|
||||||
func join(i any) string {
|
func join(i any) string {
|
||||||
switch reflect.TypeOf(i).Kind() {
|
switch i := i.(type) {
|
||||||
case reflect.Slice:
|
case []string:
|
||||||
return strings.Join(i.([]string), " ")
|
return strings.Join(i, " ")
|
||||||
case reflect.Map:
|
case map[string]string:
|
||||||
res := []string{}
|
res := []string{}
|
||||||
for k, v := range i.(map[string]string) {
|
for k, v := range i {
|
||||||
res = append(res, k+"="+v)
|
res = append(res, k+"="+v)
|
||||||
}
|
}
|
||||||
return strings.Join(res, " ")
|
return strings.Join(res, " ")
|
||||||
@ -191,16 +190,15 @@ func join(i any) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func cjoin(i any) string {
|
func cjoin(i any) string {
|
||||||
switch reflect.TypeOf(i).Kind() {
|
switch i := i.(type) {
|
||||||
case reflect.Slice:
|
case []string:
|
||||||
s := i.([]string)
|
if len(i) == 1 {
|
||||||
if len(s) == 1 {
|
return i[0]
|
||||||
return s[0]
|
|
||||||
}
|
}
|
||||||
return "(" + strings.Join(s, " ") + ")"
|
return "(" + strings.Join(i, " ") + ")"
|
||||||
case reflect.Map:
|
case map[string]string:
|
||||||
res := []string{}
|
res := []string{}
|
||||||
for k, v := range i.(map[string]string) {
|
for k, v := range i {
|
||||||
res = append(res, k+"="+v)
|
res = append(res, k+"="+v)
|
||||||
}
|
}
|
||||||
return "(" + strings.Join(res, " ") + ")"
|
return "(" + strings.Join(res, " ") + ")"
|
||||||
|
@ -6,6 +6,7 @@ package logs
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
Loading…
Reference in New Issue
Block a user