gvisorgvisor.dev/gvisor/tools/checklocks Index | Files | Directories

package checklocks

import "gvisor.dev/gvisor/tools/checklocks"

Package checklocks performs lock analysis to identify and flag unprotected access to annotated fields.

For detailed usage refer to README.md in the same directory.

Note that this package uses the built-in atomics, in order to avoid the use of our own atomic package. This is because our own atomic package depends on our own sync package, which includes lock dependency analysis. This in turn requires goid, which introduces a dependency cycle. To avoid this, we simply use the simpler, built-in sync package.

+checkalignedignore

Index

Variables

var Analyzer = &analysis.Analyzer{
	Name:     "checklocks",
	Doc:      "checks lock preconditions on functions and fields",
	Run:      run,
	Requires: []*analysis.Analyzer{buildssa.Analyzer},
	FactTypes: []analysis.Fact{
		(*atomicAlignment)(nil),
		(*lockGuardFacts)(nil),
		(*lockFunctionFacts)(nil),
	},
}

Analyzer is the main entrypoint.

Source Files

analysis.go annotations.go checklocks.go facts.go state.go

Directories

PathSynopsis
tools/checklocks/cmd
tools/checklocks/cmd/checklocksBinary checklocks is a `vettool` for `go vet`.
tools/checklocks/testPackage test is a test package.
tools/checklocks/test/crosspkgPackage crosspkg is a second package for testing.
Version
v0.0.0-20250605235530-a6711d1e1dc6 (latest)
Published
Jun 5, 2025
Platform
linux/amd64
Imports
12 packages
Last checked
4 hours ago

Tools for package owners.