I would like to ask if it is normal practice to make global enums?
For example, I have appConfig.go and in this package there is an enum
type Provider string
const (
AWS Provider = "aws"
GCP Provider = "gcp"
AZURE Provider = "azure"
)
and I have method GetProvider
func (s *Config) GetProvider(contractId string) (Provider, error) {
// method
}
And I have a usecase that uses the Config service, I’m describing an interface and if I use Provider enum I need to import the config package. And that’s not right.
type configService interface {
GetProvider(contractId string) (config.Provider, error)
}
If I put this enum in a separate file, I can use it in both the interface and the configuration package. But I’m not sure if this is a good practice.
What are your thoughts?