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

Bug: using Default with imports selects first matching func by name #508

Open
na4ma4 opened this issue Jun 11, 2024 · 2 comments · May be fixed by #509
Open

Bug: using Default with imports selects first matching func by name #508

na4ma4 opened this issue Jun 11, 2024 · 2 comments · May be fixed by #509
Labels

Comments

@na4ma4
Copy link

na4ma4 commented Jun 11, 2024

Bug Description
When using imports, namespaces and Default, the getFunction() function will return the first matching function in the import with the same name, regardless of namespacing.

So

// project magefile.go
var Default = mage.Test

// imported repo

type Docker mg.Namespace

func (Docker) Test() {
    log.Println("docker")
}

func Test() {
    log.Println("test")
}

Will find Docker.Test() before Test().

What did you do?

Created a test repository as an example

What did you expect to happen?

$ mage
test

What actually happened?

$ mage
docker

Environment

  • Mage Version: Mage Build Tool 1.15.0
  • OS: darwin/arm64

Additional context

@na4ma4 na4ma4 linked a pull request Jun 11, 2024 that will close this issue
@natefinch
Copy link
Member

ooh, thanks for the report and the repro steps

@na4ma4
Copy link
Author

na4ma4 commented Aug 26, 2024

I did a PR as well to fix it #509

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

Successfully merging a pull request may close this issue.

2 participants