MCPcopy Index your code
hub / github.com/coder/coder / templateVersionParametersNotFound

Function templateVersionParametersNotFound

cli/parameterresolver.go:432–446  ·  view source on GitHub ↗
(unknown string, params []codersdk.TemplateVersionParameter)

Source from the content-addressed store, hash-verified

430}
431
432func templateVersionParametersNotFound(unknown string, params []codersdk.TemplateVersionParameter) error {
433 var sb strings.Builder
434 _, _ = sb.WriteString(fmt.Sprintf("parameter %q is not present in the template.", unknown))
435 // Going with a fairly generous edit distance
436 maxDist := len(unknown) / 2
437 var paramNames []string
438 for _, p := range params {
439 paramNames = append(paramNames, p.Name)
440 }
441 matches := levenshtein.Matches(unknown, maxDist, paramNames...)
442 if len(matches) > 0 {
443 _, _ = sb.WriteString(fmt.Sprintf("\nDid you mean: %s", strings.Join(matches, ", ")))
444 }
445 return xerrors.Errorf(sb.String())
446}

Callers 1

verifyConstraintsMethod · 0.85

Calls 4

MatchesFunction · 0.92
WriteStringMethod · 0.80
ErrorfMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected