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

Aliases fail on imported namespaces #192

Closed
200sc opened this issue Nov 5, 2018 · 1 comment · Fixed by #203
Closed

Aliases fail on imported namespaces #192

200sc opened this issue Nov 5, 2018 · 1 comment · Fixed by #203
Labels

Comments

@200sc
Copy link

200sc commented Nov 5, 2018

Given this Magefile at site.go/project:

// +build mage

package main

import (
	// mage:import
	"site.com/project/subfolder"
)

var Aliases = map[string]interface{}{
	"fizz": subfolder.Foo.Bar,
}

And this single go file being imported from site.go/project/subfolder:

// +build mage

package subfolder

import (
	"github.com/magefile/mage/mg"
)

type Foo mg.Namespace

func (Foo) Bar() error {
	return nil
}

The following warning is received on running mage: warning: alias declaration (fizz) does not reference a mage target

Following this, mage exits with status 1.

mage -version outputs:

Mage Build Tool v1.7.1
Build Date: 2018-10-31T09:48:07-05:00
Commit: 11d1591
built with: go1.11

This was built on windows/amd64

The behavior expected would be for fizz to be a valid alias to the target in the subfolder.

@natefinch
Copy link
Member

So, when you import from another package, the code you import can't be marked with the mage build tag. However, even without the mage build tag, it still fails with that error.

I'll make a fix, it's probably something small and easy.

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