check

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package check detects orphaned genqlient call sites in a service directory.

An orphan is a `genqlient.<Op>(...)` call whose operation has no matching `# @genqlient` annotation block declaring it in any of the .go files genqlient.yaml's `operations:` field globs. The genqlient generator picks up operations only from those annotation blocks, so an orphan compiles only until the next `make genqlient` run drops the unbacked operation from the generated client. This pattern arose in the ai-guide and donations services after a migration removed annotations but left call sites; this package exists to surface that class of regression at lint time, not at the next regen.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Orphan

type Orphan struct {
	Operation string // e.g. "AiGuide_AllSetsOfStandards"
	File      string // path relative to the service directory
	Line      int    // 1-based source line of the call site
}

Orphan describes a `genqlient.<Op>(...)` call site whose Op is not declared by any `# @genqlient` annotation in the scanned files.

func Run

func Run(dir string) ([]Orphan, error)

Run scans the service directory at dir for orphaned genqlient calls and returns them in source order (by file, then by line). dir must contain a `genqlient.yaml` whose `operations:` field globs the .go files to scan.

Returns an empty (non-nil) slice when dir is clean. Returns a non-nil error only for IO/parse failures — a service with orphans returns (orphans, nil) and the caller decides whether to treat that as a failure or a report.

Jump to

Keyboard shortcuts

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