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 }