globalvar

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 6 Imported by: 0

README

yze-go-globalvar

A yze analyzer (category immutability) that reports package-level mutable vars, which the gomatic immutability/dependency-injection standard forbids: prefer a constant or dependency injection. A small allow-listed set of sanctioned package vars (version, Analyzer, Registration) — plus any configured via the -allow flag — is permitted.

  • Rule: yze/globalvar
  • Library: exports Analyzer (a standard go/analysis analyzer) and Registration for the yze aggregator and stickler runner.
  • Binary: cmd/yze-go-globalvar runs it standalone (text/-json, and as a go vet -vettool).
  • Config: -allow takes a comma-separated list of additional permitted package-level var names.

Built on the go-yze framework.

Documentation

Overview

Package globalvar provides a go/analysis analyzer enforcing the gomatic immutability/DI standard: package-level mutable vars are forbidden. Prefer a constant or dependency injection. A small allow-listed set of sanctioned package vars (and any configured via the -allow flag) is permitted.

Index

Constants

This section is empty.

Variables

View Source
var Analyzer = newAnalyzer()

Analyzer reports package-level mutable vars that are not allow-listed.

View Source
var Registration = goyze.Registration{
	Name:       "globalvar",
	Categories: []goyze.Category{"immutability"},
	URL:        "https://docs.gomatic.dev/yze/globalvar",
	Analyzer:   Analyzer,
}

Registration declares this analyzer to the yze framework.

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
cmd
yze-go-globalvar command
Command yze-go-globalvar runs the globalvar analyzer as a standalone go/analysis checker (text and -json output, and usable as a `go vet -vettool`).
Command yze-go-globalvar runs the globalvar analyzer as a standalone go/analysis checker (text and -json output, and usable as a `go vet -vettool`).

Jump to

Keyboard shortcuts

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