Skip to content

Commit

Permalink
bake: make error clearer
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidGamba committed Jun 14, 2024
1 parent 7717b0a commit 0beba08
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bake/tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 0beba08

Please sign in to comment.