Skip to content

dev: simplify appends with slices.Concat #5215

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/golinters/gocritic/gocritic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func Test_settingsWrapper_InferEnabledChecks(t *testing.T) {
t.Logf("enabled by default checks:\n%s", strings.Join(enabledByDefaultChecks, "\n"))

insert := func(in []string, toInsert ...string) []string {
return append(slices.Clone(in), toInsert...)
return slices.Concat(in, toInsert)
}

remove := func(in []string, toRemove ...string) []string {
Expand Down
9 changes: 3 additions & 6 deletions pkg/lint/lintersdb/validator_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package lintersdb

import (
"slices"
"testing"

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

v := NewValidator(m)

var testCases []validatorTestCase
testCases = append(testCases, validateLintersNamesTestCases...)
testCases = append(testCases, validatePresetsTestCases...)
testCases := slices.Concat(validateLintersNamesTestCases, validatePresetsTestCases)

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

v := NewValidator(m)

var testCases []validateErrorTestCase
testCases = append(testCases, validateLintersNamesErrorTestCases...)
testCases = append(testCases, validatePresetsErrorTestCases...)
testCases := slices.Concat(validateLintersNamesErrorTestCases, validatePresetsErrorTestCases)

for _, test := range testCases {
t.Run(test.desc, func(t *testing.T) {
Expand Down
Loading