diagnostics

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: MPL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FixEndpointHeaderFromMessage = "endpoint_header_from_message"
	FixInsertMissingUse          = "insert_missing_use"
)

Variables

View Source
var Registry = []Code{}/* 105 elements not displayed */

Registry is the current inventory of diagnostic codes emitted by the parser, compiler, build generator, contract scanner, and language tooling.

Functions

func Suggestions

func Suggestions(code string, limit int) []string

Suggestions returns close diagnostic-code matches for an unknown code.

Types

type Code

type Code struct {
	Code      string
	Area      string
	Stability Stability
	Severity  Severity
	Fix       *Fix
	Summary   string
}

Code describes one public diagnostic code emitted by GOWDK tooling.

func Lookup

func Lookup(code string) (Code, bool)

Lookup returns the registry entry for code.

type Explanation

type Explanation struct {
	Code      string    `json:"code"`
	Area      string    `json:"area"`
	Stability Stability `json:"stability"`
	Severity  Severity  `json:"severity"`
	Fix       *Fix      `json:"fix,omitempty"`
	Summary   string    `json:"summary"`
	Details   string    `json:"details,omitempty"`
	NextSteps []string  `json:"nextSteps,omitempty"`
	Invalid   string    `json:"invalid,omitempty"`
	Fixed     string    `json:"fixed,omitempty"`
}

Explanation is the user-facing diagnostic explanation payload.

func Explain

func Explain(code string) (Explanation, bool)

Explain returns a user-facing explanation for code.

type Fix added in v0.3.0

type Fix struct {
	Title       string `json:"title"`
	Description string `json:"description"`
	Rewriter    string `json:"rewriter,omitempty"`
}

Fix describes one machine-readable rewrite available for a diagnostic code.

func FixFor added in v0.3.0

func FixFor(code string) (Fix, bool)

FixFor returns the registry fix metadata for code.

type Severity added in v0.3.0

type Severity string

Severity describes the default impact of a diagnostic code. Individual emitters may still upgrade or downgrade a diagnostic when runtime context makes that more precise.

const (
	SeverityError   Severity = "error"
	SeverityWarning Severity = "warning"
	SeverityInfo    Severity = "info"
)

func DefaultSeverity added in v0.3.0

func DefaultSeverity(code string) (Severity, bool)

DefaultSeverity returns the registry severity for code.

type Stability

type Stability string

Stability describes how much compatibility a diagnostic code currently has.

const (
	StabilityStable       Stability = "stable"
	StabilityExperimental Stability = "experimental"
	StabilityAddon        Stability = "addon"
)

Jump to

Keyboard shortcuts

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