infer

package
v0.2.11 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package infer bridges auto-detection and the provider registry: it decides whether a line Clover recognizes would actually resolve, offline. The one gate is shared by annotate, which writes a directive above each passing line, and by run --infer, which synthesizes a marker for it without writing anything - so the two features can never disagree about what is trackable.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Directive

func Directive(inf match.Inference) directive.Directive

Directive builds the directive a provider=auto marker binds for inf: the inferred provider plus every parameter read from the line. It is what the gate validates the provider resource against.

func Recognizable

func Recognizable(path string, lines []string, i int) bool

Recognizable reports whether lines[i] names a complete reference, stopping before the heavier offline resolution gate. It backs opt-out diagnostics, which only need to know a line would otherwise have been a candidate.

func Recognize

func Recognize(path string, lines []string, i int) (match.Inference, string, bool)

Recognize reports the inference for lines[i] and whether its line would resolve: ok is false when no auto route matches at all, and reason carries why a matched line still cannot resolve (an incomplete reference, a provider resource that does not build, a version the rewriter cannot locate). A matched line with an empty reason is safe to annotate or update.

func Unresolved

func Unresolved(
	providerName string,
	d directive.Directive,
	line string,
	rewriter func() (match.Rewriter, error),
) string

Unresolved runs the offline checks lint and run perform against a candidate annotation: the provider must exist, build a valid resource from d, and the rewriter must locate a trackable version on line. An empty reason means the candidate is safe to emit.

Types

This section is empty.

Jump to

Keyboard shortcuts

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