From 2f3eda37a4dd64f1202fac1c69ab819fb0bd7a5e Mon Sep 17 00:00:00 2001 From: Adin Scannell Date: Wed, 19 May 2021 10:55:02 -0700 Subject: Fix nogo analysis. Ignore calls to atomic functions in case there is no analysis information. It is unclear why this has broken in some cases, perhaps these functions have been replaced by intrinsics as an optimization? PiperOrigin-RevId: 374682441 --- tools/checkescape/checkescape.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/checkescape/checkescape.go b/tools/checkescape/checkescape.go index 8eeabbc3d..c788654a8 100644 --- a/tools/checkescape/checkescape.go +++ b/tools/checkescape/checkescape.go @@ -709,8 +709,13 @@ func run(pass *analysis.Pass, localEscapes bool) (interface{}, error) { return } - // Recursively collect information from - // the other analyzers. + // If this package is the atomic package, the implementation + // may be replaced by instrinsics that don't have analysis. + if x.Pkg.Pkg.Path() == "sync/atomic" { + return + } + + // Recursively collect information. var imp packageEscapeFacts if !pass.ImportPackageFact(x.Pkg.Pkg, &imp) { // Unable to import the dependency; we must -- cgit v1.2.3