From 16dc811cb73d1e3e4e1519b1d854428202d6568b Mon Sep 17 00:00:00 2001 From: Jamie Liu Date: Tue, 15 Aug 2023 15:41:29 -0700 Subject: [PATCH] Fix expected import path for Go cmd/vendor packages. PiperOrigin-RevId: 557273882 --- tools/nogo/check/check.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/nogo/check/check.go b/tools/nogo/check/check.go index a5a115c40..0f194c7b1 100644 --- a/tools/nogo/check/check.go +++ b/tools/nogo/check/check.go @@ -742,6 +742,10 @@ func SplitPackages(srcs []string, srcRootPrefix string) map[string][]string { continue } + // In Go's sources, vendored packages under cmd/vendor are imported via + // paths not containing cmd/vendor. + pkg = strings.TrimPrefix(pkg, "cmd/vendor/") + // Place the special runtime package (functions emitted by the // compiler itself) into the runtime packages. if strings.Contains(filename, "cmd/compile/internal/typecheck/_builtin/runtime.go") {