component: Automatically determine names

This commit is contained in:
Tom Wiesing 2022-10-17 20:39:53 +02:00
parent 10df1c3243
commit e320bb37bb
No known key found for this signature in database
31 changed files with 84 additions and 113 deletions

View file

@ -10,20 +10,11 @@ package component
//
// Components are initialized using a [Pool].
type Component interface {
// Name returns the name of this component.
// It should correspond to the appropriate subpackage.
// Name returns the name of this component
// Name should be implemented by the [ComponentBase] struct.
Name() string
// getBase returns the embedded ComponentBase struct.
getBase() *ComponentBase
}
// ComponentBase should be embedded into every component
type ComponentBase struct {
Core // the underlying stillage of the distillery
}
//lint:ignore U1000 used to implement the private methods of [Component]
func (cb *ComponentBase) getBase() *ComponentBase {
return cb
// getComponentBase returns the underlying ComponentBase object of this Component.
// It is used internally during initialization
getComponentBase() *ComponentBase
}