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