Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Nested Namespaces #433

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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