diff --git a/util/buildflags/printfunc.go b/util/buildflags/printfunc.go index 6a5a95c1..1019702f 100644 --- a/util/buildflags/printfunc.go +++ b/util/buildflags/printfunc.go @@ -12,17 +12,10 @@ import ( const defaultPrintFunc = "build" func ParsePrintFunc(str string) (*controllerapi.PrintFunc, error) { - if str == "" || str == defaultPrintFunc { + if str == "" { return nil, nil } - // "check" has been added as an alias for "lint", - // in order to maintain backwards compatibility - // we need to convert it. - if str == "check" { - str = "lint" - } - csvReader := csv.NewReader(strings.NewReader(str)) fields, err := csvReader.Read() if err != nil { @@ -51,5 +44,17 @@ func ParsePrintFunc(str string) (*controllerapi.PrintFunc, error) { f.Name = field } } + + // "check" has been added as an alias for "lint", + // in order to maintain backwards compatibility + // we need to convert it. + if f.Name == "check" { + f.Name = "lint" + } + + if f.Name == defaultPrintFunc { + return nil, nil + } + return f, nil }