From 8681c47df61e7c52b44ff1f4239db9464c0694c8 Mon Sep 17 00:00:00 2001 From: andig Date: Mon, 19 Feb 2024 19:44:56 +0100 Subject: [PATCH] Simplify Strings() using slices package --- enumer.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/enumer.go b/enumer.go index c234209..b3228bc 100644 --- a/enumer.go +++ b/enumer.go @@ -30,9 +30,7 @@ func %[1]sValues() []%[1]s { // [1]: type name const stringsMethod = `// %[1]sStrings returns a slice of all String values of the enum func %[1]sStrings() []string { - strs := make([]string, len(_%[1]sNames)) - copy(strs, _%[1]sNames) - return strs + return slices.Clone(_%[1]sNames) } `