mage
mage copied to clipboard
feat: Nested Namespaces
Provide the ability to nest namespaces by defining a type that transitively is a mg.Namespace.
Namespaces can have functions named the same as a sub-namespace.
An example magefile:
type Docker mg.Namespace
func (Docker) Build() { fmt.Println("docker:build") }
type Developer Docker
func (Developer) Build() { fmt.Println("docker:developer:build") }
type CI Docker
func (CI) Build() { fmt.Println("docker:ci:build") }
Results in the following:
Targets:
docker:build
docker:ci:build
docker:developer:build
Closes #152
This does not implement nested/transitive imports, only namespaces.
Any traction on this? Would be a really nice feature to add in for us. Would allow us to do something like mage staging:go:build
or mage production:pulumi:apply
Any chance this can be merged?