Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / honnef.co / go / tools@v0.0.1-2020.1.5 / doc / formatters.html
1 <!--(
2      "Title": "Output formatters"
3 )-->
4
5 <h2 id="text">Text</h2>
6
7 <p>
8   <em>Text</em> is the default output formatter.
9   It formats problems using the following format: <code>file:line:col: message</code>.
10   This format is commonly used by compilers and linters,
11   and is understood by most editors.
12 </p>
13
14 <h3>Example output</h3>
15 <pre><code>go/src/fmt/print.go:1069:15: this value of afterIndex is never used (SA4006)</code></pre>
16
17 <h2 id="stylish">Stylish</h2>
18
19 <p>
20   <em>Stylish</em> is a formatter designed for human consumption.
21   It groups results by file name
22   and breaks up the various pieces of information into columns.
23   Additionally, it displays a final summary.
24 </p>
25
26 <p>
27   This output format is not suited for automatic consumption by tools
28   and may change between versions.
29 </p>
30
31 <pre><code>go/src/fmt/fmt_test.go
32   (43, 2)     S1021   should merge variable declaration with assignment on next line
33   (1185, 10)  SA9003  empty branch
34
35 go/src/fmt/print.go
36   (77, 18)    ST1006  methods on the same type should have the same receiver name (seen 3x "b", 1x "bp")
37   (1069, 15)  SA4006  this value of afterIndex is never used
38
39 go/src/fmt/scan.go
40   (465, 5)  ST1012  error var complexError should have name of the form errFoo
41   (466, 5)  ST1012  error var boolError should have name of the form errFoo
42
43  ✖ 6 problems (6 errors, 0 warnings)
44 </code></pre>
45
46 <h2 id="json">JSON</h2>
47
48 <p>
49   The JSON formatter emits one JSON object per problem found –
50   that is, it is a stream of objects, not an array.
51   Most fields should be self-explanatory.
52 </p>
53
54 <p>
55   The <code>severity</code> field may be one of
56   <code>"error"</code>, <code>"warning"</code> or <code>"ignored"</code>.
57   Whether a problem is an error or a warning is determined by the <code>-fail</code> flag.
58   The value <code>"ignored"</code> is used for problems that were ignored,
59   if the <code>-show-ignored</code> flag was provided.
60 </p>
61
62 <h3>Example output</h3>
63 <p>
64   Note that actual output is not formatted nicely.
65   The example has been formatted to improve readability.
66 </p>
67
68 <pre><code>{
69   "code": "SA4006",
70   "severity": "error",
71   "location": {
72     "file": "/usr/lib/go/src/fmt/print.go",
73     "line": 1082,
74     "column": 15
75   },
76   "end": {
77     "file": "/usr/lib/go/src/fmt/print.go",
78     "line": 1082,
79     "column": 25
80   },
81   "message": "this value of afterIndex is never used"
82 }</code></pre>