mage icon indicating copy to clipboard operation
mage copied to clipboard

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

Open na4ma4 opened this issue 3 weeks ago • 1 comments

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 avatar Jun 11 '24 07:06 na4ma4