From dd7c905f7efc1a43b142cc9839a40f1dada7a42d Mon Sep 17 00:00:00 2001 From: Anthony TREUILLIER Date: Fri, 22 May 2026 09:13:50 +0200 Subject: [PATCH] feat: Add GetIdentifier Signed-off-by: Anthony TREUILLIER --- errors.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/errors.go b/errors.go index b7c2f92..35186d4 100644 --- a/errors.go +++ b/errors.go @@ -213,7 +213,7 @@ func (e *Error) Error() string { b, "%s (%s):", strings.ToLower(e.Title), - concatenateUint32Slice(e.Identifier), + e.GetIdentifier(), ) if len(e.Details) > 0 { @@ -329,15 +329,14 @@ func trace() *Trace { } } -// concatenateUint32Slice takes a slice of uint32 and returns a single reversed string -// with all elements joined by a hyphen ("-"). -func concatenateUint32Slice(nums []uint32) string { - if len(nums) == 0 { +// GetIdentifier returns a string with all identifiers reversed and joined by a hyphen ("-"). +func (e *Error) GetIdentifier() string { + if len(e.Identifier) == 0 { return "" } // Clone to avoid modifying the original slice. - clone := slices.Clone(nums) + clone := slices.Clone(e.Identifier) slices.Reverse(clone) // Use a strings.Builder for efficient string concatenation.