mage icon indicating copy to clipboard operation
mage copied to clipboard

feat: Nested Namespaces

Open 56KBs opened this issue 2 years ago • 2 comments

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.

56KBs avatar Jun 27 '22 15:06 56KBs

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

Penthious avatar Nov 16 '22 16:11 Penthious

Any chance this can be merged?

rzajac avatar Jan 11 '23 15:01 rzajac