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

Add error_format for Go #45

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lit/main.lit
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,9 @@ Supported compilers/linters are:
* `pyflakes`
* `jshint`
* `dmd`
* `cargo`
* `rustc`
* `go`

--- Check for compiler errors +=
if (errorFormat is null) {
Expand All @@ -298,10 +301,12 @@ if (errorFormat is null) {
else if (compilerCmd.indexOf("dmd") != -1) { errorFormat = "%f\\(%l\\):%s: %m"; }
else if (compilerCmd.indexOf("cargo") != -1) { errorFormat = "%s --> %f:%l:%m%s"; }
else if (compilerCmd.indexOf("rustc") != -1) { errorFormat = "%s --> %f:%l:%m%s"; }
else if (compilerCmd.indexOf("go") != -1) { errorFormat = "%f:%l:%s: %m"; }
}
---

Now we actually go through and create the regex, by replacing the `%l`, `%f`, and `%m` with
Now we actually go through and create the regex, by replacing the `%l` (line
number), `%f` (file name), and `%m` (error message) with
matched regular expressions. Then we execute the shell command, parse each error
using the error format, and rewrite the error with the proper filename and line number
given by the array `codeLinenums` that we created earlier.
Expand Down