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 committed Dec 6, 2023
1 parent 44e1233 commit b5505c2
Show file tree
Hide file tree
Showing 2 changed files with 4 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
4 changes: 3 additions & 1 deletion pkg/driver/type/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import (
"github.com/falcosecurity/falcoctl/pkg/output"
)

const TypeAuto = "auto"

Check warning on line 28 in pkg/driver/type/type.go

View workflow job for this annotation

GitHub Actions / Lint golang files

exported: exported const TypeAuto should have comment or be unexported (revive)

var driverTypes = map[string]DriverType{}

// DriverType is the interface that wraps driver types.
Expand All @@ -46,7 +48,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 b5505c2

Please sign in to comment.