cleanup: rename EncryptionTypeString() to EncryptionType.String()

This makes it easier to log the EncryptionType as string, or int,
whatever is preferred. Standard fmt formatting notations like %s or %d
can be used now.

Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
Niels de Vos
2024-03-29 17:07:14 +01:00
committed by mergify[bot]
parent 5a6556c4d4
commit 86b5db90bc
4 changed files with 24 additions and 24 deletions

View File

@ -111,7 +111,7 @@ func ParseEncryptionType(typeStr string) EncryptionType {
}
}
func EncryptionTypeString(encType EncryptionType) string {
func (encType EncryptionType) String() string {
switch encType {
case EncryptionTypeBlock:
return encryptionTypeBlockString

View File

@ -77,7 +77,7 @@ func TestEncryptionType(t *testing.T) {
assert.EqualValues(t, EncryptionTypeNone, ParseEncryptionType(""))
for _, s := range []string{"file", "block", ""} {
assert.EqualValues(t, s, EncryptionTypeString(ParseEncryptionType(s)))
assert.EqualValues(t, s, ParseEncryptionType(s).String())
}
}