analysisflags

package
v0.39.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2025 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

Package analysisflags defines helpers for processing flags (-help, -json, -fix, -diff, etc) common to unitchecker and {single,multi}checker. It is not intended for broader use.

Index

Constants

This section is empty.

Variables

View Source
var (
	JSON    = false // -json
	Context = -1    // -c=N: if N>0, display offending line plus N lines of context
	Fix     bool    // -fix
	Diff    bool    // -diff
)

flags common to all {single,multi,unit}checkers.

Functions

func Help

func Help(progname string, analyzers []*analysis.Analyzer, args []string)

Help implements the help subcommand for a multichecker or unitchecker style command. The optional args specify the analyzers to describe. Help calls log.Fatal if no such analyzer exists.

func Parse

func Parse(analyzers []*analysis.Analyzer, multi bool) []*analysis.Analyzer

Parse creates a flag for each of the analyzer's flags, including (in multi mode) a flag named after the analyzer, parses the flags, then filters and returns the list of analyzers enabled by flags.

The result is intended to be passed to unitchecker.Run or checker.Run. Use in unitchecker.Run will gob.Register all fact types for the returned graph of analyzers but of course not the ones only reachable from dropped analyzers. To avoid inconsistency about which gob types are registered from run to run, Parse itself gob.Registers all the facts only reachable from dropped analyzers. This is not a particularly elegant API, but this is an internal package.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL