checkstate

command
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Command checkstate audits the library package for hidden state and unplanned panics. It type-checks the non-test files that the current build selects in the given directory and requires that:

  • every package-level variable is unexported and has a value type (basic, or arrays and structs of value types), so it cannot be a knob another package sets or a reference another value shares;
  • no expression anywhere in the package, including package-level initializers and function literals, writes such a variable: no assignment, increment, range assignment, address-of, aliasing slice of an array, pointer-receiver method call or copy/append/delete/clear through it;
  • there is no init function;
  • panic appears only inside functions named Must followed by an upper-case letter (MustParse, which is meant for literals).

Names are resolved with go/types, so shadowing and aliasing through local declarations are handled exactly rather than by spelling.

Jump to

Keyboard shortcuts

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