ctxerr is a Go library and CLI utility for pretty-printing linter/parser errors.
Instead of just describing what's wrong, it lets you point at the wrong input:
narf.txt:1:8: string is missing closing quote
1 | "foo bar
| ^ missing closing quote
- Create pretty error messages for linters, parsers, etc. by pointing at the relevant position in the source code.
- Parse existing error messages into
Ctx
structs. - CLI utility
ctx
scans STDIN for linter errors and enhances them with the reported source line.
go get -u github.com/nochso/ctxerr
go install github.com/nochso/ctxerr/cmd/ctx
The GoDoc pages contain plenty of examples.
$ ctx -h
ctx 1.0.0-beta
Pretty prints parser errors from stdin.
Possible input:
path/file.ext:1:5: some error on line 1, column 5
file.ext:123: column is optional and so is the message:
file.ext:1
Usage:
ctx < log.txt
gometalinter . | ctx
Flags:
-context NUM
print NUM lines of context surrounding an error. negative for all, positive for limited and 0 for none (default)
-no-color
disable any color output
-pessimistic
print only matching errors, ignore everything else
All notable changes to this project will be documented in the changelog.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
This project is released under the MIT license.