From dad7b53d9cc9538f6c2f036479a3b2df0705905b Mon Sep 17 00:00:00 2001 From: Lan Phan Date: Fri, 13 Sep 2024 15:31:51 +0700 Subject: [PATCH] add new tag ignore to prevent printing specific field --- pkg/dynamic/print_config.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/dynamic/print_config.go b/pkg/dynamic/print_config.go index a60d30618..8210c003e 100644 --- a/pkg/dynamic/print_config.go +++ b/pkg/dynamic/print_config.go @@ -91,6 +91,9 @@ func PrintConfig(s interface{}, f io.Writer, style *table.Style, withColor bool, continue } if jtag := tt.Tag.Get("json"); jtag != "" && jtag != "-" { + if ig := tt.Tag.Get("ignore"); ig == "true" { + continue + } name := strings.Split(jtag, ",")[0] if _, ok := redundantSet[name]; ok { continue @@ -106,6 +109,9 @@ func PrintConfig(s interface{}, f io.Writer, style *table.Style, withColor bool, } default: name := strings.Split(jsonTag, ",")[0] + if ig := t.Tag.Get("ignore"); ig == "true" { + continue + } if _, ok := redundantSet[name]; ok { continue }