check

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0, MIT Imports: 57 Imported by: 0

Documentation

Overview

Package check implements binary analysis similar to bazel's nogo, or the unitchecker package. It exists in order to provide additional facilities for analysis, namely plumbing through the output from dumping the generated binary (to analyze actual produced code).

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrSkip indicates the package should be skipped.
	ErrSkip = errors.New("skipped")
)

Functions

func FindRoot

func FindRoot(srcs []string, srcRootRegex string) (string, error)

FindRoot finds a package root.

func SplitPackages

func SplitPackages(srcs []string, srcRootPrefix string) map[string][]string

SplitPackages splits a typical package structure into packages.

func WriteFindingsTo

func WriteFindingsTo(w io.Writer, findings FindingSet, asJSON bool) error

WriteFindingsTo serializes findings.

Types

type Finding

type Finding struct {
	Category string
	Position token.Position
	Message  string
	GOARCH   string
	GOOS     string
}

Finding is a single finding.

func (*Finding) String

func (f *Finding) String() string

String implements fmt.Stringer.String.

type FindingSet

type FindingSet []Finding

FindingSet is a collection of findings.

func Bundle

func Bundle(sources map[string][]string) (FindingSet, facts.Serializer, error)

Bundle checks a bundle of files (typically the standard library).

func ExtractFindingsFrom

func ExtractFindingsFrom(r io.Reader, asJSON bool) (findings FindingSet, err error)

ExtractFindingsFrom loads findings from an io.Reader.

func ExtractFindingsFromFile

func ExtractFindingsFromFile(filename string, asJSON bool) (FindingSet, error)

ExtractFindingsFromFile loads findings from a file.

func Package

func Package(path string, srcs []string) (FindingSet, facts.Serializer, error)

Package runs all analyzer on a single package.

func (FindingSet) Sort

func (fs FindingSet) Sort()

Sort sorts all findings.

Jump to

Keyboard shortcuts

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