gvisorgvisor.dev/gvisor/tools/checkconst Index | Files

package checkconst

import "gvisor.dev/gvisor/tools/checkconst"

Package checkconst checks constant values.

This analyzer supports multiple annotations: checkconst, checkoffset, checksize and checkalign. Each of these essentially checks the value of the declared constant (or the #define'ed value in the case of an assembly file) against the value seen during analysis. If this does not match, an error is emitted with the appropriate value for that constant/offset/size/alignment.

Index

Variables

var Analyzer = &analysis.Analyzer{
	Name: "checkconst",
	Doc:  "validates basic constants",
	Run:  run,
	FactTypes: []analysis.Fact{
		(*Constants)(nil),
	},
}

Analyzer defines the entrypoint.

Types

type Constants

type Constants struct {
	Alignments map[string]int64
	Offsets    map[string]int64
	Sizes      map[string]int64
	Values     map[string]string
}

Constants contains all constant values.

func (*Constants) AFact

func (*Constants) AFact()

AFact implements analysis.Fact.AFact.

Source Files

checkconst.go

Version
v0.0.0-20250605235530-a6711d1e1dc6 (latest)
Published
Jun 5, 2025
Platform
linux/amd64
Imports
9 packages
Last checked
4 hours ago

Tools for package owners.