Skip to content

Commit 0e446e1

Browse files
xieyuschendennypenta
authored andcommitted
go/pacakges: remove some todos
* use std slices.Clip * remove outdated check as the original issue was fixed Change-Id: Ie54b202ecabc3318a4f20772fd62bd63542f8237 Reviewed-on: https://go-review.googlesource.com/c/tools/+/626416 Reviewed-by: Michael Matloob <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Auto-Submit: Alan Donovan <[email protected]> Reviewed-by: Alan Donovan <[email protected]>
1 parent aa91891 commit 0e446e1

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

go/packages/external.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"fmt"
1414
"os"
1515
"os/exec"
16+
"slices"
1617
"strings"
1718
)
1819

@@ -131,7 +132,7 @@ func findExternalDriver(cfg *Config) driver {
131132
// command.
132133
//
133134
// (See similar trick in Invocation.run in ../../internal/gocommand/invoke.go)
134-
cmd.Env = append(slicesClip(cfg.Env), "PWD="+cfg.Dir)
135+
cmd.Env = append(slices.Clip(cfg.Env), "PWD="+cfg.Dir)
135136
cmd.Stdin = bytes.NewReader(req)
136137
cmd.Stdout = buf
137138
cmd.Stderr = stderr
@@ -150,7 +151,3 @@ func findExternalDriver(cfg *Config) driver {
150151
return &response, nil
151152
}
152153
}
153-
154-
// slicesClip removes unused capacity from the slice, returning s[:len(s):len(s)].
155-
// TODO(adonovan): use go1.21 slices.Clip.
156-
func slicesClip[S ~[]E, E any](s S) S { return s[:len(s):len(s)] }

go/packages/packages_test.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -511,11 +511,6 @@ func testConfigDir(t *testing.T, exporter packagestest.Exporter) {
511511
test.dir, test.pattern, got, test.want)
512512
}
513513
if fails != test.fails {
514-
// TODO: remove when go#28023 is fixed
515-
if test.fails && strings.HasPrefix(test.pattern, "./") && exporter == packagestest.Modules {
516-
// Currently go list in module mode does not handle missing directories correctly.
517-
continue
518-
}
519514
t.Errorf("dir %q, pattern %q: error %v, want %v",
520515
test.dir, test.pattern, fails, test.fails)
521516
}

0 commit comments

Comments
 (0)