From 0beba08c709413219ce003be35f759186a11ed09 Mon Sep 17 00:00:00 2001 From: David Gamba Date: Fri, 14 Jun 2024 01:42:15 -0600 Subject: [PATCH] bake: make error clearer --- bake/tree.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bake/tree.go b/bake/tree.go index 04da543..00572eb 100644 --- a/bake/tree.go +++ b/bake/tree.go @@ -63,7 +63,7 @@ func (ot *OptTree) AddCommand(name, descName, description string) (*getoptions.G if len(keys) == i+1 { desc = description } - err := validateCmdName(key) + err := validateCmdName(key, descName) if err != nil { return nil, err } @@ -118,10 +118,10 @@ var golangKeywords = map[string]struct{}{ "var": struct{}{}, } -func validateCmdName(name string) error { +func validateCmdName(name, descName string) error { // if command name matches a golang keyword, return an error if _, ok := golangKeywords[name]; ok { - return fmt.Errorf("command name '%s' is a golang keyword", name) + return fmt.Errorf("command name '%s' in '%s' is a golang keyword", name, descName) } return nil }