suggest

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 3 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 suggest ranks the names a user probably meant when the one they typed matches nothing: request ids, environment names and the like.

Index

Constants

View Source
const Max = 3

Max is how many names Closest returns at most: enough to show the likely intended one, few enough to read in an error line.

Variables

This section is empty.

Functions

func Closest

func Closest(query string, candidates []string) []string

Closest returns up to Max of candidates that are close to query, best first: a candidate query is a prefix of, then one query occurs in, then one within a few edits of it (one edit for a short query, three for a long one). Case, and the difference between - and _, do not count. It returns nil when nothing is close enough, or the query is a single letter: a wrong name should not get a guess for the sake of it.

func Phrase

func Phrase(names []string) string

Phrase renders names as "did you mean a, b or c?", or "" for none.

Types

This section is empty.

Jump to

Keyboard shortcuts

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