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

Catch error message for multiple Go packages #904

Closed
wants to merge 1 commit into from
Closed

Conversation

@phst
Copy link
Contributor

@phst phst commented Mar 8, 2016

If there are multiple Go packages in a single directory, go build will
bail out. Catch the error message printed by the tool and turn it into
an informational message because Flycheck can’t really syntax-check such
packages.

Because the error message doesn’t contain a line number, install an
error filter to fake a line number. Otherwise the message would be
ignored.

Fixes GH-676 and closes GH-676.

@cpitclaudel
Copy link
Member

@cpitclaudel cpitclaudel commented Mar 8, 2016

Thanks for working on this! I made a small comment in the source. I'll let @lunaryorn comment further.

@cpitclaudel
Copy link
Member

@cpitclaudel cpitclaudel commented Mar 8, 2016

By the way, I don't think yo need to say both "Fixes" and "Closes" in your commit message; just one is enough to close the issue.

@lunaryorn
Copy link
Contributor

@lunaryorn lunaryorn commented Mar 9, 2016

If this new type of errors is the only one from Go that doesn't include a line number, then maybe you could just add a line number to any error that doesn't have one, instead of (re-)matching every message?

Indeed, I think that'd be much simpler.

line-end))
:error-filter
(lambda (errors)
(dolist (error errors errors)

This comment has been minimized.

@lunaryorn

lunaryorn Mar 9, 2016
Contributor

Please return errors explicitly after the loop. I am no particular fan of this behaviour of dolist.

"found packages a (a.go) and b (b.go) in "
(flycheck-ert-resource-filename
"checkers/go/src/multipkg"))
:checker go-build))))

This comment has been minimized.

@lunaryorn

lunaryorn Mar 9, 2016
Contributor

Thank you for adding a test case 👍

If there are multiple Go packages in a single directory, `go build` will
bail out.  Catch the error message printed by the tool and turn it into
an informational message because Flycheck can’t really syntax-check such
packages.

Because the error message doesn’t contain a line number, install an
error filter to fake a line number.  Otherwise the message would be
ignored.

Fixes GH-676.
@phst phst force-pushed the phst:bug676 branch from 230a288 to 6790834 Mar 12, 2016
@phst
Copy link
Contributor Author

@phst phst commented Mar 12, 2016

Thanks for the review. Resolved the comments.

@lunaryorn
Copy link
Contributor

@lunaryorn lunaryorn commented Mar 17, 2016

@phst Thank you very much, cherry-picked ☺️ 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

3 participants