Skip to content

Magefile can't use application code defined in the same directory #188

Closed
@dradtke

Description

@dradtke

I have an application whose design is inspired by this post; in particular, domain objects are all stored in the application's root package, which is also the top-level folder of the repository. Since it's the top of the repository, I also have my main Magefile defined there, and lately it's been failing to compile because it finds two packages in that directory: main and (for example) app:

Mage.go:20:2: found packages main (Mage.go) and app (app.go) in /Users/dradtke/Workspace/app

This used to work, so I'm not sure what recent change actually caused it to break. The version of Mage I'm using:

$ mage -version
Mage Build Tool v1.7.0
Build Date: 2018-10-12T10:40:22-05:00
Commit: 0f9693c
built with: go1.11

The workaround seems to be pretty simple, which is to move application code down one level, leaving the Magefile as the sole Go file at the root. This is kind of annoying though, since it requires re-architecting the application in order to avoid compilation errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions