[go] go/types: exclude all packages under simd/archsimd/_gen

0 views
Skip to first unread message

Austin Clements (Gerrit)

unread,
5:16 PM (5 hours ago) 5:16 PM
to Robert Griesemer, David Chase, Junyang Shao, goph...@pubsubhelper.golang.org, Austin Clements, golang-co...@googlegroups.com
Attention needed from David Chase, Junyang Shao and Robert Griesemer

Austin Clements has uploaded the change for review

Austin Clements would like Robert Griesemer, David Chase and Junyang Shao to review this change.

Commit message

go/types: exclude all packages under simd/archsimd/_gen

Right now we manually exclude every package under simd/archsimd/_gen
from TestStdlib. We're about to add another package and it took me far
too long to realize it needed to be excluded as well. To future-proof
this, add support for excluding x/... patterns and use this for
simd/archsimd/_gen.
Change-Id: Id3dcc94d9d125984dd3abe958f198cff3196bade

Change diff

diff --git a/src/cmd/compile/internal/types2/stdlib_test.go b/src/cmd/compile/internal/types2/stdlib_test.go
index 94d31ba..9f0a5ff 100644
--- a/src/cmd/compile/internal/types2/stdlib_test.go
+++ b/src/cmd/compile/internal/types2/stdlib_test.go
@@ -352,19 +352,28 @@
}

// Package paths of excluded packages.
-var excluded = map[string]bool{
- "builtin": true,
- "cmd/compile/internal/ssa/_gen": true,
- "crypto/internal/cryptotest/wycheproof/_schema": true,
- "crypto/internal/cryptotest/x509limbo/_schema": true,
- "runtime/_mkmalloc": true,
- "simd/archsimd/_gen/midway": true,
- "simd/archsimd/_gen/sgutil": true,
- "simd/archsimd/_gen/simdgen": true,
- "simd/archsimd/_gen/simdgen/arm64": true,
- "simd/archsimd/_gen/tmplgen": true,
- "simd/archsimd/_gen/unify": true,
- "simd/archsimd/_gen/wasmgen": true,
+var excluded = slices.SortedFunc(slices.Values([]string{
+ "builtin",
+ "cmd/compile/internal/ssa/_gen/...",
+ "crypto/internal/cryptotest/wycheproof/_schema",
+ "crypto/internal/cryptotest/x509limbo/_schema",
+ "runtime/_mkmalloc",
+ "simd/archsimd/_gen/...",
+}), func(a, b string) int {
+ pA, _ := strings.CutSuffix(a, "/...")
+ pB, _ := strings.CutSuffix(b, "/...")
+ return strings.Compare(pA, pB)
+})
+
+func isExcluded(path string) bool {
+ _, found := slices.BinarySearchFunc(excluded, path, func(pattern, target string) int {
+ prefix, isWild := strings.CutSuffix(pattern, "/...")
+ if isWild && (target == prefix || strings.HasPrefix(target, prefix+"/")) {
+ return 0
+ }
+ return strings.Compare(prefix, target)
+ })
+ return found
}

// printPackageMu synchronizes the printing of type-checked package files in
@@ -443,7 +452,7 @@
}
return nil, err
}
- if excluded[pkg.ImportPath] {
+ if isExcluded(pkg.ImportPath) {
return nil, nil
}
if slices.Contains(strings.Split(pkg.ImportPath, "/"), "_asm") {
diff --git a/src/go/types/stdlib_test.go b/src/go/types/stdlib_test.go
index d4ff0af..27b1e7a 100644
--- a/src/go/types/stdlib_test.go
+++ b/src/go/types/stdlib_test.go
@@ -354,19 +354,28 @@
}

// Package paths of excluded packages.
-var excluded = map[string]bool{
- "builtin": true,
- "cmd/compile/internal/ssa/_gen": true,
- "crypto/internal/cryptotest/wycheproof/_schema": true,
- "crypto/internal/cryptotest/x509limbo/_schema": true,
- "runtime/_mkmalloc": true,
- "simd/archsimd/_gen/midway": true,
- "simd/archsimd/_gen/sgutil": true,
- "simd/archsimd/_gen/simdgen": true,
- "simd/archsimd/_gen/simdgen/arm64": true,
- "simd/archsimd/_gen/tmplgen": true,
- "simd/archsimd/_gen/unify": true,
- "simd/archsimd/_gen/wasmgen": true,
+var excluded = slices.SortedFunc(slices.Values([]string{
+ "builtin",
+ "cmd/compile/internal/ssa/_gen/...",
+ "crypto/internal/cryptotest/wycheproof/_schema",
+ "crypto/internal/cryptotest/x509limbo/_schema",
+ "runtime/_mkmalloc",
+ "simd/archsimd/_gen/...",
+}), func(a, b string) int {
+ pA, _ := strings.CutSuffix(a, "/...")
+ pB, _ := strings.CutSuffix(b, "/...")
+ return strings.Compare(pA, pB)
+})
+
+func isExcluded(path string) bool {
+ _, found := slices.BinarySearchFunc(excluded, path, func(pattern, target string) int {
+ prefix, isWild := strings.CutSuffix(pattern, "/...")
+ if isWild && (target == prefix || strings.HasPrefix(target, prefix+"/")) {
+ return 0
+ }
+ return strings.Compare(prefix, target)
+ })
+ return found
}

// printPackageMu synchronizes the printing of type-checked package files in
@@ -445,7 +454,7 @@
}
return nil, err
}
- if excluded[pkg.ImportPath] {
+ if isExcluded(pkg.ImportPath) {
return nil, nil
}
if slices.Contains(strings.Split(pkg.ImportPath, "/"), "_asm") {

Change information

Files:
  • M src/cmd/compile/internal/types2/stdlib_test.go
  • M src/go/types/stdlib_test.go
Change size: M
Delta: 2 files changed, 46 insertions(+), 28 deletions(-)
Open in Gerrit

Related details

Attention is currently required from:
  • David Chase
  • Junyang Shao
  • Robert Griesemer
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Id3dcc94d9d125984dd3abe958f198cff3196bade
Gerrit-Change-Number: 812040
Gerrit-PatchSet: 1
Gerrit-Owner: Austin Clements <aus...@google.com>
Gerrit-Reviewer: Austin Clements <aus...@google.com>
Gerrit-Reviewer: David Chase <drc...@google.com>
Gerrit-Reviewer: Junyang Shao <shaoj...@google.com>
Gerrit-Reviewer: Robert Griesemer <g...@google.com>
Gerrit-Attention: Robert Griesemer <g...@google.com>
Gerrit-Attention: David Chase <drc...@google.com>
Gerrit-Attention: Junyang Shao <shaoj...@google.com>
unsatisfied_requirement
satisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages