From b4eb079045b1c653c29fd204e10f77bf884d3a5c Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 22 Sep 2020 14:47:55 +0200 Subject: [PATCH] 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 --- cmd/docker/docker.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/docker/docker.go b/cmd/docker/docker.go index 35ccb130b7..b9ff6772f6 100644 --- a/cmd/docker/docker.go +++ b/cmd/docker/docker.go @@ -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 } }