mage
mage copied to clipboard
Named imports not working with Aliases
I think I found a small bug that occurs when using a PackageName in an import declaration and declaring an alias that references that package. It seems that the Name
from the ast.ImportSpec
isn't stored when parsing.
// +build mage
package main
import (
"github.com/andrewkroh/project/common/mage"
// mage:import
subproject "github.com/andrewkroh/project/subproject/mage"
)
var Aliases = map[string]interface{}{
"update": subproject.Update.All,
}
...
This results in an error like:
2018/12/31 02:17:01 warning, alias malformed: unknown package for function &{%!q(*ast.SelectorExpr=&{0xc000099440 0xc000099460}) "All"}
I can probably cook up a test case if that helps.
oops, yeah, that sounds like a bug. Thanks!