Skip to content

Consolidate operator type constants #627

@joelanford

Description

@joelanford

We use two different sets of constants to define operator types:

One set is used for parsing command line options, which necessarily need to be strings:

goOperatorType = "go"
ansibleOperatorType = "ansible"

The other set is used when we detect the type of operator on disk, e.g. for operator-sdk up local:

const (
// OperatorTypeGo - golang type of operator.
OperatorTypeGo OperatorType = iota
// OperatorTypeAnsible - ansible type of operator.
OperatorTypeAnsible
)

As we add more operator types (e.g. helm), we'll have to be careful to add new types to both sets of constants, and keep track what each set is used for.

Does it make sense to consolidate these to the iota-based consts in the cmdutil package and add a helper function to the cmdutil package to convert a type string to the constant?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions