Fix buildkit flags not being hidden without buildkit enabled

These annotations use `nil` as value, which caused the flag-hiding functions
to ignore the annotations, and therefore not hiding the flags.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2020-09-22 14:47:55 +02:00
parent e4b7edde09
commit b4eb079045
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
1 changed files with 6 additions and 2 deletions

View File

@ -316,8 +316,12 @@ func hideFlagIf(f *pflag.Flag, condition func(string) bool, annotation string) {
if f.Hidden {
return
}
if values, ok := f.Annotations[annotation]; ok && len(values) > 0 {
if condition(values[0]) {
var val string
if values, ok := f.Annotations[annotation]; ok {
if len(values) > 0 {
val = values[0]
}
if condition(val) {
f.Hidden = true
}
}