Skip to content

Conversation

56KBs
Copy link

@56KBs 56KBs commented Jun 27, 2022

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.

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.
@aluzzardi aluzzardi mentioned this pull request Oct 20, 2022
@Penthious
Copy link

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

@rzajac
Copy link

rzajac commented Jan 11, 2023

Any chance this can be merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nested namespaces
3 participants