Skip to content

Commit 0fc3097

Browse files
committed
replace append with slices methods where applies
1 parent a1d9079 commit 0fc3097

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

bind/bind_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@ import (
2121
"path"
2222
"path/filepath"
2323
"runtime"
24+
"slices"
2425
"strings"
2526
"testing"
2627

28+
"golang.org/x/exp/slices"
2729
"golang.org/x/mobile/internal/importers"
2830
"golang.org/x/mobile/internal/importers/java"
2931
"golang.org/x/mobile/internal/importers/objc"
@@ -287,7 +289,7 @@ func genJavaPackages(t *testing.T, dir string, cg *ClassGen) {
287289
func TestGenJava(t *testing.T) {
288290
allTests := tests
289291
if java.IsAvailable() {
290-
allTests = append(append([]string{}, allTests...), javaTests...)
292+
allTests = slices.Concat(allTests, javaTests)
291293
}
292294
for _, filename := range allTests {
293295
var pkg *types.Package

cmd/gomobile/build.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"os"
1515
"os/exec"
1616
"regexp"
17+
"slices"
1718
"strconv"
1819
"strings"
1920

@@ -338,7 +339,7 @@ func goCmdAt(at string, subcmd string, srcs []string, env []string, args ...stri
338339
if gmc, err := goModCachePath(); err == nil {
339340
env = append([]string{"GOMODCACHE=" + gmc}, env...)
340341
} else {
341-
env = append([]string{}, env...)
342+
env = slices.Clone(env)
342343
}
343344
cmd.Env = env
344345
cmd.Dir = at
@@ -356,7 +357,7 @@ func goModTidyAt(at string, env []string) error {
356357
if gmc, err := goModCachePath(); err == nil {
357358
env = append([]string{"GOMODCACHE=" + gmc}, env...)
358359
} else {
359-
env = append([]string{}, env...)
360+
env = slices.Clone(env)
360361
}
361362
cmd.Env = env
362363
cmd.Dir = at

0 commit comments

Comments
 (0)