Skip to content

Commit d1d9131

Browse files
committed
chore(cmd,pkg): use a constant for auto driver type.
Signed-off-by: Federico Di Pierro <[email protected]>
1 parent 44e1233 commit d1d9131

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

cmd/driver/driver_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ func NewDriverCmd(ctx context.Context, opt *options.Common) *cobra.Command {
120120
}
121121
}
122122

123-
if driverTypes.String() != "auto" {
123+
if driverTypes.String() != drivertype.TypeAuto {
124124
var err error
125125
// Ok driver type was enforced by the user
126126
driver.Type, err = drivertype.Parse(driverTypes.String())

pkg/driver/type/type.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ import (
2525
"github.com/falcosecurity/falcoctl/pkg/output"
2626
)
2727

28+
// TypeAuto enables a smart automatic driver selection logic instead of using a fixed driver type.
29+
const TypeAuto = "auto"
30+
2831
var driverTypes = map[string]DriverType{}
2932

3033
// DriverType is the interface that wraps driver types.
@@ -46,7 +49,7 @@ func GetTypes() []string {
4649
}
4750
// auto is a sentinel value to enable automatic driver selection logic,
4851
// but it is not mapped to any DriverType
49-
driverTypesSlice = append(driverTypesSlice, "auto")
52+
driverTypesSlice = append(driverTypesSlice, TypeAuto)
5053
return driverTypesSlice
5154
}
5255

0 commit comments

Comments
 (0)