Skip to content

Commit 0a43427

Browse files
committed
dev: simplify appends with slices.Concat
1 parent ba4b6df commit 0a43427

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

pkg/golinters/gocritic/gocritic_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func Test_settingsWrapper_InferEnabledChecks(t *testing.T) {
4040
t.Logf("enabled by default checks:\n%s", strings.Join(enabledByDefaultChecks, "\n"))
4141

4242
insert := func(in []string, toInsert ...string) []string {
43-
return append(slices.Clone(in), toInsert...)
43+
return slices.Concat(in, toInsert)
4444
}
4545

4646
remove := func(in []string, toRemove ...string) []string {

pkg/lint/lintersdb/validator_test.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package lintersdb
22

33
import (
4+
"slices"
45
"testing"
56

67
"github.com/stretchr/testify/require"
@@ -113,9 +114,7 @@ func TestValidator_Validate(t *testing.T) {
113114

114115
v := NewValidator(m)
115116

116-
var testCases []validatorTestCase
117-
testCases = append(testCases, validateLintersNamesTestCases...)
118-
testCases = append(testCases, validatePresetsTestCases...)
117+
testCases := slices.Concat(validateLintersNamesTestCases, validatePresetsTestCases)
119118

120119
for _, test := range testCases {
121120
t.Run(test.desc, func(t *testing.T) {
@@ -133,9 +132,7 @@ func TestValidator_Validate_error(t *testing.T) {
133132

134133
v := NewValidator(m)
135134

136-
var testCases []validateErrorTestCase
137-
testCases = append(testCases, validateLintersNamesErrorTestCases...)
138-
testCases = append(testCases, validatePresetsErrorTestCases...)
135+
testCases := slices.Concat(validateLintersNamesErrorTestCases, validatePresetsErrorTestCases)
139136

140137
for _, test := range testCases {
141138
t.Run(test.desc, func(t *testing.T) {

0 commit comments

Comments
 (0)