From f680b6e82e4dfdd31b3aaa9c95e77e25e73b517d Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Fri, 18 Aug 2023 17:59:56 +0200 Subject: [PATCH] Cleanup: use slices.Delete to delete elements from a slice I find this much easier to read. --- pkg/utils/formatting.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/utils/formatting.go b/pkg/utils/formatting.go index bf4f0debd..93be8ec5c 100644 --- a/pkg/utils/formatting.go +++ b/pkg/utils/formatting.go @@ -5,6 +5,7 @@ import ( "github.com/mattn/go-runewidth" "github.com/samber/lo" + "golang.org/x/exp/slices" ) type Alignment int @@ -82,7 +83,7 @@ outer: // remove the columns for i, strings := range displayStringsArr { for j := len(toRemove) - 1; j >= 0; j-- { - strings = append(strings[:toRemove[j]], strings[toRemove[j]+1:]...) + strings = slices.Delete(strings, toRemove[j], toRemove[j]+1) } displayStringsArr[i] = strings }