refractor: rename some path util function.

This commit is contained in:
Alexandre Pujol 2024-10-12 15:31:24 +01:00
parent ebdeef152c
commit 982c2c66aa
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
13 changed files with 87 additions and 82 deletions

View file

@ -10,7 +10,6 @@ import (
"testing"
"github.com/roddhjav/apparmor.d/pkg/paths"
"github.com/roddhjav/apparmor.d/pkg/util"
)
var (
@ -21,7 +20,7 @@ var (
// mustReadProfileFile read a file and return its content as a slice of string.
// It panics if an error occurs. It removes the last comment line.
func mustReadProfileFile(path *paths.Path) string {
res := strings.Split(util.MustReadFile(path), "\n")
res := strings.Split(path.MustReadFileAsString(), "\n")
return strings.Join(res[:len(res)-2], "\n")
}
@ -108,7 +107,7 @@ func TestAppArmorProfileFile_String(t *testing.T) {
},
}},
},
want: util.MustReadFile(testData.Join("string.aa")),
want: testData.Join("string.aa").MustReadFileAsString(),
},
}
for _, tt := range tests {