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

Improve error message for failed imports #298

Merged
merged 10 commits into from
Apr 3, 2020

Conversation

aknuds1
Copy link
Contributor

@aknuds1 aknuds1 commented Mar 31, 2020

This PR improves the error message when importing packages fails, for example because an imported package has a build tag (e.g. mage). A test is also included.

Plus, I edited the documentation to clarify how Mage doesn't support importing package files with build tags.

aknuds1 added 2 commits March 31, 2020 11:17
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
@natefinch
Copy link
Member

As mentioned in slack, adding the mage build tag would change the behavior for folks currently using mage, and that could break stuff. You don't need the mage tag on stuff you import. As you pointed out in slack, the comment on this in the docs is not clear at all, and I welcome proposed changes to the wording.

I do like the fix to print a better error message, however.

aknuds1 added 2 commits April 1, 2020 09:44
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
@aknuds1 aknuds1 changed the title Fix importing modules with mage build tag Improve error message for failed imports Apr 1, 2020
@aknuds1
Copy link
Contributor Author

aknuds1 commented Apr 1, 2020

@natefinch Thanks, I modified the PR to only improve the error message (along with a test). Please have another look.

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
natefinch
natefinch previously approved these changes Apr 1, 2020
Copy link
Member

@natefinch natefinch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thanks!

mage/import_test.go Outdated Show resolved Hide resolved
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
aknuds1 added 4 commits April 3, 2020 09:21
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Copy link
Member

@natefinch natefinch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thank you!

@natefinch natefinch merged commit 8a5905f into magefile:master Apr 3, 2020
@aknuds1 aknuds1 deleted the bugfix/fix-importing-targets branch April 3, 2020 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants