diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/bazel.mk | 4 | ||||
-rw-r--r-- | tools/nogo/nogo.go | 20 |
2 files changed, 22 insertions, 2 deletions
diff --git a/tools/bazel.mk b/tools/bazel.mk index 1444423e4..68b804ec4 100644 --- a/tools/bazel.mk +++ b/tools/bazel.mk @@ -186,8 +186,8 @@ build_paths = \ (set -euo pipefail; \ $(call wrapper,$(BAZEL) build $(BASE_OPTIONS) $(BAZEL_OPTIONS) $(1)) && \ $(call wrapper,$(BAZEL) cquery $(BASE_OPTIONS) $(BAZEL_OPTIONS) $(1) --output=starlark --starlark:file=tools/show_paths.bzl) \ - | xargs -r -n 1 -I {} bash -c 'test -e "{}" || exit 0; readlink -f "{}"' \ - | xargs -r -n 1 -I {} bash -c 'set -euo pipefail; $(2)') + | xargs -r -I {} bash -c 'test -e "{}" || exit 0; readlink -f "{}"' \ + | xargs -r -I {} bash -c 'set -euo pipefail; $(2)') clean = $(call header,CLEAN) && $(call wrapper,$(BAZEL) clean) build = $(call header,BUILD $(1)) && $(call build_paths,$(1),echo {}) diff --git a/tools/nogo/nogo.go b/tools/nogo/nogo.go index d95d7652f..2f88f84db 100644 --- a/tools/nogo/nogo.go +++ b/tools/nogo/nogo.go @@ -293,6 +293,19 @@ func CheckStdlib(config *StdlibConfig, analyzers []*analysis.Analyzer) (allFindi break } + // Go standard library packages using Go 1.18 type parameter features. + // + // As of writing, analysis tooling is not updated to support type + // parameters and will choke on these packages. We skip these packages + // entirely for now. + // + // TODO(b/201686256): remove once tooling can handle type parameters. + usesTypeParams := map[string]struct{}{ + "constraints": struct{}{}, // golang.org/issue/45458 + "maps": struct{}{}, // golang.org/issue/47649 + "slices": struct{}{}, // golang.org/issue/45955 + } + // Aggregate all files by directory. packages := make(map[string]*PackageConfig) for _, file := range config.Srcs { @@ -306,10 +319,17 @@ func CheckStdlib(config *StdlibConfig, analyzers []*analysis.Analyzer) (allFindi continue // Not a file. } pkg := d[len(rootSrcPrefix):] + // Skip cmd packages and obvious test files: see above. if strings.HasPrefix(pkg, "cmd/") || strings.HasSuffix(file, "_test.go") { continue } + + if _, ok := usesTypeParams[pkg]; ok { + log.Printf("WARNING: Skipping package %q: type param analysis not yet supported", pkg) + continue + } + c, ok := packages[pkg] if !ok { c = &PackageConfig{ |