build: using slices.Clone to simplify codes

This commit is contained in:
cuiweixie 2024-03-29 10:33:25 +08:00
parent a3829178af
commit 9b5ec23f7f

View file

@ -48,6 +48,7 @@ import (
"path"
"path/filepath"
"runtime"
"slices"
"strconv"
"strings"
"time"
@ -232,8 +233,7 @@ func doInstall(cmdline []string) {
// Do the build!
for _, pkg := range packages {
args := make([]string, len(gobuild.Args))
copy(args, gobuild.Args)
args := slices.Clone(gobuild.Args)
args = append(args, "-o", executablePath(path.Base(pkg)))
args = append(args, pkg)
build.MustRun(&exec.Cmd{Path: gobuild.Path, Args: args, Env: gobuild.Env})