All go files can have an init function that's called at the start of the program. Instead of hard coding the names of each provider in a list somewhere, add a map[string]interface{} map to provider.go that holds a map of names to providers. each provider should add their name and value to that map in their init function. so for example:
This would make adding providers a bit more maintainable since all you would have to do is add that in each new provider. Whenever you add a new provider, nothing needs to be changed in any other files and you can just drop it in there.
You can also use ProviderList in other places where you need a list of providers. For instance, when adding a manga, instead of hardcoding values, you could just loop through that list.
All go files can have an
init
function that's called at the start of the program. Instead of hard coding the names of each provider in a list somewhere, add amap[string]interface{}
map toprovider.go
that holds a map of names to providers. each provider should add their name and value to that map in their init function. so for example:provider.go
mangakakalot.go
This would make adding providers a bit more maintainable since all you would have to do is add that in each new provider. Whenever you add a new provider, nothing needs to be changed in any other files and you can just drop it in there.
You can also use
ProviderList
in other places where you need a list of providers. For instance, when adding a manga, instead of hardcoding values, you could just loop through that list.