diff --git a/cmd/driver/driver_linux.go b/cmd/driver/driver_linux.go index 5d0d3a90..f056a79a 100644 --- a/cmd/driver/driver_linux.go +++ b/cmd/driver/driver_linux.go @@ -120,7 +120,7 @@ func NewDriverCmd(ctx context.Context, opt *options.Common) *cobra.Command { } } - if driverTypes.String() != "auto" { + if driverTypes.String() != drivertype.TypeAuto { var err error // Ok driver type was enforced by the user driver.Type, err = drivertype.Parse(driverTypes.String()) diff --git a/pkg/driver/type/type.go b/pkg/driver/type/type.go index 0febd788..dcebf6fb 100644 --- a/pkg/driver/type/type.go +++ b/pkg/driver/type/type.go @@ -25,6 +25,9 @@ import ( "github.com/falcosecurity/falcoctl/pkg/output" ) +// TypeAuto enables a smart automatic driver selection logic instead of using a fixed driver type. +const TypeAuto = "auto" + var driverTypes = map[string]DriverType{} // DriverType is the interface that wraps driver types. @@ -46,7 +49,7 @@ func GetTypes() []string { } // auto is a sentinel value to enable automatic driver selection logic, // but it is not mapped to any DriverType - driverTypesSlice = append(driverTypesSlice, "auto") + driverTypesSlice = append(driverTypesSlice, TypeAuto) return driverTypesSlice }