analyze

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package analyze holds the Gx go/analysis passes: route packages (GX3005) and safe HTML conversions (GX7001). gx lint runs them over a module and the lintplugin package registers them with golangci-lint (REQ-TLS-03).

Index

Constants

This section is empty.

Variables

View Source
var EnumCoverage = &analysis.Analyzer{
	Name: "gxenum",
	Doc:  "report a gx.Enum map that misses a constant of its type (GX5001)",
	Run:  runEnum,
}

EnumCoverage reports a gx.Enum[T] map that misses a constant of T (GX5001, REQ-STY-05).

View Source
var RoutePackage = &analysis.Analyzer{
	Name: "gxroutepkg",
	Doc:  "report code other than route types in a route package (GX3005)",
	Run:  runRoutePackage,
}

RoutePackage reports code other than route types in a route package (GX3005, REQ-RTE-20).

View Source
var RuntimeClass = &analysis.Analyzer{
	Name: "gxclassruntime",
	Doc:  "report a gx.Cx argument built at runtime (GX5003)",
	Run:  runRuntimeClass,
}

RuntimeClass reports a gx.Cx argument built at runtime with fmt.Sprintf, fmt.Sprint, strings.Join or a non-constant concatenation (GX5003, REQ-STY-11).

View Source
var SafeHTML = &analysis.Analyzer{
	Name: "gxsafehtml",
	Doc:  "report a gx.SafeHTML conversion of a non-constant value without //gx:trusted (GX7001)",
	Run:  runSafeHTML,
}

SafeHTML reports a gx.SafeHTML conversion of a non-constant value without //gx:trusted on the same line (GX7001, SI-01).

Functions

func Analyzers

func Analyzers() []*analysis.Analyzer

Analyzers returns the Gx analyzers in a stable order (REQ-TLS-03).

Types

type Finding

type Finding struct {
	File    string
	Line    int
	Col     int
	Code    string
	Message string
}

Finding is one analyzer result.

func Lint

func Lint(dir string) ([]Finding, error)

Lint runs every Gx analyzer over the packages of dir and returns the findings ordered by position (REQ-TLS-03). Generated files are included, so //line directives report .gx positions.

Jump to

Keyboard shortcuts

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