From a8934c3655531b7d674c84b9b16dd34a5b75b515 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Mon, 19 Jun 2023 07:54:55 +0200 Subject: [PATCH] make linter happy Signed-off-by: Christian Richter --- services/audit/pkg/types/helpers.go | 3 ++- services/audit/pkg/types/messages.go | 32 ++++++++++++++-------------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/services/audit/pkg/types/helpers.go b/services/audit/pkg/types/helpers.go index cc76e7cb3..989cb66c2 100644 --- a/services/audit/pkg/types/helpers.go +++ b/services/audit/pkg/types/helpers.go @@ -2,7 +2,8 @@ package types import "strings" -func SplitId(id string) (string, string) { +// SplitStorageIDFromSpaceID splits the storage- and spaceid- from the given string +func SplitStorageIDFromSpaceID(id string) (string, string) { ids := strings.Split(id, "$") if len(ids) != 2 { return id, "" diff --git a/services/audit/pkg/types/messages.go b/services/audit/pkg/types/messages.go index 8ef8e3fe7..ce28ae52f 100644 --- a/services/audit/pkg/types/messages.go +++ b/services/audit/pkg/types/messages.go @@ -139,51 +139,51 @@ func MessageFileVersionRestored(executant, item, version string) string { // MessageSpaceCreated returns the human readable string that describes the action func MessageSpaceCreated(executant, spaceID, name string) string { - storagId, spaceID := SplitId(spaceID) - return fmt.Sprintf("user '%s' created a space '%s' with name '%s' (storage: '%s')", executant, spaceID, name, storagId) + storagID, spaceID := SplitStorageIDFromSpaceID(spaceID) + return fmt.Sprintf("user '%s' created a space '%s' with name '%s' (storage: '%s')", executant, spaceID, name, storagID) } // MessageSpaceRenamed returns the human readable string that describes the action func MessageSpaceRenamed(executant, spaceID, name string) string { - storagId, spaceID := SplitId(spaceID) - return fmt.Sprintf("user '%s' renamed space '%s' to '%s' (storage: '%s')", executant, spaceID, name, storagId) + storagID, spaceID := SplitStorageIDFromSpaceID(spaceID) + return fmt.Sprintf("user '%s' renamed space '%s' to '%s' (storage: '%s')", executant, spaceID, name, storagID) } // MessageSpaceDisabled returns the human readable string that describes the action func MessageSpaceDisabled(executant, spaceID string) string { - storagId, spaceID := SplitId(spaceID) - return fmt.Sprintf("user '%s' disabled the space '%s' (storage: '%s')", executant, spaceID, storagId) + storagID, spaceID := SplitStorageIDFromSpaceID(spaceID) + return fmt.Sprintf("user '%s' disabled the space '%s' (storage: '%s')", executant, spaceID, storagID) } // MessageSpaceEnabled returns the human readable string that describes the action func MessageSpaceEnabled(executant, spaceID string) string { - storagId, spaceID := SplitId(spaceID) - return fmt.Sprintf("user '%s' (re-) enabled the space '%s' (storage: '%s')", executant, spaceID, storagId) + storagID, spaceID := SplitStorageIDFromSpaceID(spaceID) + return fmt.Sprintf("user '%s' (re-) enabled the space '%s' (storage: '%s')", executant, spaceID, storagID) } // MessageSpaceDeleted returns the human readable string that describes the action func MessageSpaceDeleted(executant, spaceID string) string { - storagId, spaceID := SplitId(spaceID) - return fmt.Sprintf("user '%s' deleted the space '%s' (storage: '%s')", executant, spaceID, storagId) + storagID, spaceID := SplitStorageIDFromSpaceID(spaceID) + return fmt.Sprintf("user '%s' deleted the space '%s' (storage: '%s')", executant, spaceID, storagID) } // MessageSpaceShared returns the human readable string that describes the action func MessageSpaceShared(executant, spaceID, grantee string) string { - storagId, spaceID := SplitId(spaceID) - return fmt.Sprintf("user '%s' shared the space '%s' with '%s' (storage: '%s')", executant, spaceID, grantee, storagId) + storagID, spaceID := SplitStorageIDFromSpaceID(spaceID) + return fmt.Sprintf("user '%s' shared the space '%s' with '%s' (storage: '%s')", executant, spaceID, grantee, storagID) } // MessageSpaceUnshared returns the human readable string that describes the action func MessageSpaceUnshared(executant, spaceID, grantee string) string { - storagId, spaceID := SplitId(spaceID) - return fmt.Sprintf("user '%s' unshared the space '%s' with '%s' (storage: '%s')", executant, spaceID, grantee, storagId) + storagID, spaceID := SplitStorageIDFromSpaceID(spaceID) + return fmt.Sprintf("user '%s' unshared the space '%s' with '%s' (storage: '%s')", executant, spaceID, grantee, storagID) } // MessageSpaceUpdated returns the human readable string that describes the action func MessageSpaceUpdated(executant, spaceID, name string, quota uint64, opaque map[string]string) string { - storagId, spaceID := SplitId(spaceID) + storagID, spaceID := SplitStorageIDFromSpaceID(spaceID) return fmt.Sprintf("user '%s' updated space '%s'. name: '%s', quota: '%d', opaque: '%s' (storage: '%s')", - executant, spaceID, name, quota, opaque, storagId) + executant, spaceID, name, quota, opaque, storagID) } // MessageUserCreated returns the human readable string that describes the action