You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Go analysis framework allows an Analyzer to indicate that it is safe to run even in the presence of syntax and type errors, by setting RunDespiteErrors. However, the internal/checker package (used by {single,multi}checker) doesn't support it, as can be verified by running this main program:
go/analysis/passes/copylock/main.go
// Copyright 2024 The Go Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.//go:build ignore// The copylock command applies the golang.org/x/tools/go/analysis/passes/copylock// analysis to the specified packages of Go source code.package main
import (
"golang.org/x/tools/go/analysis/passes/copylock""golang.org/x/tools/go/analysis/singlechecker"
)
funcmain() { singlechecker.Main(copylock.Analyzer) }
$ copylock -v ./...
-: # rsc.io/tmp/goplsbug
./x.go:8:31: T (type) is not an expression
./x.go:8:31: T (type) is not an expression
copylocks: 2 errors during loading
CL https://go.dev/cl/383974 purports to have added support for RunDespiteErrors, but the heuristic it uses to classify errors as typeParseError is evidently incorrect.
adonovan
added
Analysis
Issues related to static analysis (vet, x/tools/go/analysis)
and removed
Tools
This label describes issues relating to any tools in the x/tools repository.
labels
Jun 3, 2024
The Go analysis framework allows an Analyzer to indicate that it is safe to run even in the presence of syntax and type errors, by setting RunDespiteErrors. However, the
internal/checker
package (used by{single,multi}checker
) doesn't support it, as can be verified by running this main program:go/analysis/passes/copylock/main.go
on the test case in #67787. The output is:
CL https://go.dev/cl/383974 purports to have added support for RunDespiteErrors, but the heuristic it uses to classify errors as typeParseError is evidently incorrect.
@zpavlinovic
The text was updated successfully, but these errors were encountered: