glazedmigration

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package glazedmigration provides source migrations for removed Glazed APIs.

The analyzer rewrites and reports call sites that reference Glazed settings APIs removed by the GLZ-OUTPUT-FLAGS-CLEANUP cleanup. It covers:

  • NewGlazedSchema / NewGlazedSection -> NewStructuredOutputSection (R1/R2)
  • With*SectionOptions wrappers -> unwrapped into the constructor call (R3)
  • default-map key "output" -> "format" (R4)
  • GlazedSlug -> StructuredOutputSlug (R5)
  • Setup* runtime helpers -> report-only (R6/R7/R8)
  • removed feature sections -> report-only (R9)

It runs despite type errors because the removed symbols make consuming code fail to type-check.

Index

Constants

This section is empty.

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name:             "glazedmigration",
	Doc:              "migrate removed Glazed APIs to their structured-output replacements",
	RunDespiteErrors: true,
	Run:              run,
}

Analyzer rewrites and reports calls to removed Glazed settings APIs.

Functions

This section is empty.

Types

type ApplyResult added in v1.4.3

type ApplyResult struct {
	AppliedPerFile map[string]int
	Skipped        int
}

ApplyResult reports every file modified before ApplyFixes returned. It is populated even when a later file fails, so callers can surface partial progress instead of leaving silent working-tree changes.

func ApplyFixes added in v1.4.3

func ApplyFixes(ctx context.Context, diagnostics []Diagnostic) (ApplyResult, error)

ApplyFixes applies every suggested fix carried by diagnostics, grouped per file. Edits within a file are applied from the end of the file backwards so offsets stay valid. Overlapping or out-of-range edits are skipped (counted, not fatal); a file whose edits all conflict is left untouched. Cancellation is checked before work and before each file write. On error, the returned ApplyResult describes any files already modified.

type Diagnostic added in v1.4.3

type Diagnostic struct {
	// File is the absolute path of the Go source file.
	File string
	// Line and Column are 1-based source positions of the finding.
	Line   int
	Column int
	// Message is the analyzer's human-readable diagnostic text.
	Message string
	// FixCount is the number of suggested-fix text edits attached to the
	// diagnostic.
	FixCount int
	// contains filtered or unexported fields
}

Diagnostic is one analyzer finding rendered in a form suitable for structured output and fix application.

func Scan added in v1.4.3

func Scan(ctx context.Context, paths []string) ([]Diagnostic, error)

Scan parses every Go source file reachable from paths and runs the migration analyzer over each file. paths entries may be directories (walked recursively, skipping hidden directories, vendor, node_modules, and testdata), Go-style directory patterns ending in /..., or individual .go files. Parsing uses go/parser directly — the analyzer is designed to run despite type errors, because consuming code that references removed Glazed APIs does not type-check. With no type-checker information, the rules fall back to import-aware AST matching.

Jump to

Keyboard shortcuts

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