Skip to content

Commit

Permalink
chore(cmd,pkg): use a constant for auto driver type.
Browse files Browse the repository at this point in the history
Signed-off-by: Federico Di Pierro <[email protected]>
  • Loading branch information
FedeDP authored and poiana committed Dec 6, 2023
1 parent 7b8ef7a commit d5893e1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmd/driver/driver_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
5 changes: 4 additions & 1 deletion pkg/driver/type/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
}

Expand Down

0 comments on commit d5893e1

Please sign in to comment.