-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
AnalysisIssues related to static analysis (vet, x/tools/go/analysis)Issues related to static analysis (vet, x/tools/go/analysis)FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.
Milestone
Description
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"
)
func main() { singlechecker.Main(copylock.Analyzer) }on the test case in #67787. The output is:
$ 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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
AnalysisIssues related to static analysis (vet, x/tools/go/analysis)Issues related to static analysis (vet, x/tools/go/analysis)FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.