Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lintcmd: print TOML error on invalid config
Previously the error message would get lost: % staticcheck staticcheck.conf:5:0: (last key parsed: "dot_import_whitelist") (compile) This is actually my bug; the ParseError.Message wasn't always set; fixed with: BurntSushi/toml#411 Also print a more verbose errors, which is nicer IMHO: % staticcheck staticcheck.conf:5:60: toml: error: expected a comma (',') or array terminator (']'), but got '"' At line 5, column 60: 3 | 4 | checks = ["all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022", "-ST1023"] 5 | dot_import_whitelist = ["github.com/mmcloughlin/avo/build" "github.com/mmcloughlin/avo/operand", "github.com/mmcloughlin/avo/reg"] ^ (config) % staticcheck -f json /home/martin/src/go-tools/staticcheck.conf (5, 60) config toml: error: expected a comma (',') or array terminator (']'), but got '"' At line 5, column 60: 3 | 4 | checks = ["all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022", "-ST1023"] 5 | dot_import_whitelist = ["github.com/mmcloughlin/avo/build" "github.com/mmcloughlin/avo/operand", "github.com/mmcloughlin/avo/reg"] ^ ✖ 1 problems (0 errors, 1 warnings, 0 ignored) % staticcheck -f json | jfmt { "code": "config", "end": {"column": 0, "file": "", "line": 0}, "location": {"column": 60, "file": "/home/martin/src/go-tools/staticcheck.conf", "line": 5}, "message": "toml: error: expected a comma (',') or array terminator (']'), but got '\"'\n\nAt line 5, column 60:\n\n 3 | \n 4 | checks = [\"all\", \"-ST1000\", \"-ST1003\", \"-ST1016\", \"-ST1020\", \"-ST1021\", \"-ST1022\", \"-ST1023\"]\n 5 | dot_import_whitelist = [\"github.com/mmcloughlin/avo/build\" \"github.com/mmcloughlin/avo/operand\", \"github.com/mmcloughlin/avo/reg\"]\n ^\n", "severity": "warning" }
- Loading branch information