aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/doc/ale-go.txt
blob: 1c2fc95bccf8f1d6439b2e40638d47ca41282eba (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
===============================================================================
ALE Go Integration                                             *ale-go-options*


===============================================================================
Integration Information

ALE enables `gofmt`, `gopls` and `go vet` by default. It also supports `staticcheck`,
`go build, ``gosimple`, `golangserver`, `golangci-lint`, and `goimports`.

To enable `golangci-lint`, update |g:ale_linters| as appropriate.
A possible configuration is to enable golangci-lint and `gofmt:
>
  " Enable all of the linters you want for Go.
  let g:ale_linters = {'go': ['golangci-lint', 'gofmt']}
<
                                                 *ale-options.go_go_executable*
                                                       *g:ale_go_go_executable*
                                                       *b:ale_go_go_executable*
go_go_executable
g:ale_go_go_executable
  Type: |String|
  Default: `'go'`

  The executable that will be run for the `gobuild` and `govet` linters, and
  the `gomod` fixer.

                                                   *ale-options.go_go111module*
                                                         *g:ale_go_go111module*
                                                         *b:ale_go_go111module*
go_go111module
g:ale_go_go111module
  Type: |String|
  Default: `''`

  Override the value of the `$GO111MODULE` environment variable for
  golang tools.


===============================================================================
bingo                                                            *ale-go-bingo*

                                              *ale-options.go_bingo_executable*
                                                    *g:ale_go_bingo_executable*
                                                    *b:ale_go_bingo_executable*
go_bingo_executable
g:ale_go_bingo_executable
  Type: |String|
  Default: `'bingo'`

  Location of the bingo binary file.

                                                 *ale-options.go_bingo_options*
                                                       *g:ale_go_bingo_options*
                                                       *b:ale_go_bingo_options*
go_bingo_options
g:ale_go_bingo_options
  Type: |String|
  Default: `''`


===============================================================================
cspell                                                          *ale-go-cspell*

See |ale-cspell-options|


===============================================================================
gobuild                                                        *ale-go-gobuild*

                                               *ale-options.go_gobuild_options*
                                                     *g:ale_go_gobuild_options*
                                                     *b:ale_go_gobuild_options*
go_gobuild_options
g:ale_go_gobuild_options
  Type: |String|
  Default: `''`

  This variable can be set to pass additional options to the gobuild linter.
  They are injected directly after "go test".


===============================================================================
gofmt                                                            *ale-go-gofmt*

                                                 *ale-options.go_gofmt_options*
                                                       *g:ale_go_gofmt_options*
                                                       *b:ale_go_gofmt_options*
go_gofmt_options
g:ale_go_gofmt_options
  Type: |String|
  Default: `''`

  This variable can be set to pass additional options to the gofmt fixer.


===============================================================================
gofumpt                                                        *ale-go-gofumpt*

                                            *ale-options.go_gofumpt_executable*
                                                  *g:ale_go_gofumpt_executable*
                                                  *b:ale_go_gofumpt_executable*
go_gofumpt_executable
g:ale_go_gofumpt_executable
  Type: |String|
  Default: `'gofumpt'`

  Executable to run to use as the gofumpt fixer.

                                               *ale-options.go_gofumpt_options*
                                                     *g:ale_go_gofumpt_options*
                                                     *b:ale_go_gofumpt_options*
go_gofumpt_options
g:ale_go_gofumpt_options
  Type: |String|
  Default: `''`

  Options to pass to the gofumpt fixer.


===============================================================================
goimports                                                    *ale-go-goimports*

                                          *ale-options.go_goimports_executable*
                                                *g:ale_go_goimports_executable*
                                                *b:ale_go_goimports_executable*
go_goimports_executable
g:ale_go_goimports_executable
  Type: |String|
  Default: `'goimports'`

  This variable can be set to change the executable path for goimports.

                                             *ale-options.go_goimports_options*
                                                   *g:ale_go_goimports_options*
                                                   *b:ale_go_goimports_options*
go_goimports_options
g:ale_go_goimports_options
  Type: |String|
  Default: `''`

  This variable can be set to pass additional options to the goimports fixer.


===============================================================================
golangci-lint                                            *ale-go-golangci-lint*

`golangci-lint` is a `lint_file` linter, which only lints files that are
written to disk. This differs from the default behavior of linting the buffer.
See: |ale-lint-file|

                                      *ale-options.go_golangci_lint_executable*
                                            *g:ale_go_golangci_lint_executable*
                                            *b:ale_go_golangci_lint_executable*
go_golangci_lint_executable
g:ale_go_golangci_lint_executable
  Type: |String|
  Default: `'golangci-lint'`

  The executable that will be run for golangci-lint.

                                         *ale-options.go_golangci_lint_options*
                                               *g:ale_go_golangci_lint_options*
                                               *b:ale_go_golangci_lint_options*
go_golangci_lint_options
g:ale_go_golangci_lint_options
  Type: |String|
  Default: `''`

  This variable can be changed to alter the command-line arguments to the
  golangci-lint run invocation.

                                         *ale-options.go_golangci_lint_package*
                                               *g:ale_go_golangci_lint_package*
                                               *b:ale_go_golangci_lint_package*
go_golangci_lint_package
g:ale_go_golangci_lint_package
  Type: |Number|
  Default: `0`

  When set to `1`, the whole Go package will be checked instead of only the
  current file.

golangci_lint can also be user as a fixer to format go source files. In this
case the following configuration variables can be used to configure the
formatters:

                                    *ale-options.go_golangci_formatter_executable*
                                          *g:ale_go_golangci_formatter_executable*
                                          *b:ale_go_golangci_formatter_executable*
go_golangci_formatter_executable
g:ale_go_golangci_formatter_executable
  Type: |String|
  Default: `'golangci-lint'`

  The executable that will be run for golangci-lint.

                                      *ale-options.go_golangci_formatter_options*
                                            *g:ale_go_golangci_formatter_options*
                                            *b:ale_go_golangci_formatter_options*
go_golangci_formatter_options
g:ale_go_golangci_formatter_options
  Type: |String|
  Default: `''`

  This variable can be changed to alter the command-line arguments to the
  golangci-lint fmt invocation.

===============================================================================
golangserver                                              *ale-go-golangserver*

                                         *ale-options.go_langserver_executable*
                                               *g:ale_go_langserver_executable*
                                               *b:ale_go_langserver_executable*
go_langserver_executable
g:ale_go_langserver_executable
  Type: |String|
  Default: `'go-langserver'`

  Location of the go-langserver binary file.

                                            *ale-options.go_langserver_options*
                                                  *g:ale_go_langserver_options*
                                                  *b:ale_go_langserver_options*
go_langserver_options
g:ale_go_langserver_options
  Type: |String|
  Default: `''`

  Additional options passed to the go-langserver command. Note that the
  `-gocodecompletion` option is ignored because it is handled automatically
  by the |g:ale_completion_enabled| variable.


===============================================================================
golines                                                        *ale-go-golines*

                                            *ale-options.go_golines_executable*
                                                  *g:ale_go_golines_executable*
                                                    *b:ale_go_lines_executable*
go_golines_executable
g:ale_go_golines_executable
  Type: |String|
  Default: `'golines'`

  Location of the golines binary file

                                               *ale-options.go_golines_options*
                                                     *g:ale_go_golines_options*
                                                     *b:ale_go_golines_options*
go_golines_options
g:ale_go_golines_options
  Type: |String|
  Default: `''`

  Additional options passed to the golines command. By default golines has
  --max-length=100 (lines above 100 characters will be wrapped)


===============================================================================
gopls                                                            *ale-go-gopls*

gopls is the official Go language server, and is enabled for use with ALE by
default.

To install the latest stable version of `gopls` to your `$GOPATH`, try the
following command: >

  GO111MODULE=on go get golang.org/x/tools/gopls@latest
<
If `$GOPATH` is readable by ALE, it should probably work without you having to
do anything else. See the `gopls` README file for more information:

https://github.com/golang/tools/blob/master/gopls/README.md


-------------------------------------------------------------------------------
Options
                                              *ale-options.go_gopls_executable*
                                                    *g:ale_go_gopls_executable*
                                                    *b:ale_go_gopls_executable*
go_gopls_executable
g:ale_go_gopls_executable
  Type: |String|
  Default: `'gopls'`

  See |ale-integrations-local-executables|

  ALE will search for `gopls` in locally installed directories first by
  default, and fall back on a globally installed `gopls` if it can't be found
  otherwise.

                                                 *ale-options.go_gopls_options*
                                                       *g:ale_go_gopls_options*
                                                       *b:ale_go_gopls_options*
go_gopls_options
g:ale_go_gopls_options
  Type: |String|
  Default: `''`

  Command-line options passed to the gopls executable. See `gopls -h`.

                                          *ale-options.go_gopls_fix_executable*
                                                *g:ale_go_gopls_fix_executable*
                                                *b:ale_go_gopls_fix_executable*
go_gopls_fix_executable
g:ale_go_gopls_fix_executable
  Type: |String|
  Default: `'gopls'`

  Executable to run to use as the gopls fixer.

                                             *ale-options.go_gopls_fix_options*
                                                   *g:ale_go_gopls_fix_options*
                                                   *b:ale_go_gopls_fix_options*
go_gopls_fix_options
g:ale_go_gopls_fix_options
  Type: |String|
  Default: `''`

  Options to pass to the gopls fixer.

                                            *ale-options.go_gopls_init_options*
                                                  *g:ale_go_gopls_init_options*
                                                  *b:ale_go_gopls_init_options*
go_gopls_init_options
g:ale_go_gopls_init_options
  Type: |Dictionary|
  Default: `{}`

  LSP initialization options passed to gopls. This can be used to configure
  the behaviour of gopls.

  For example: >
  let g:ale_go_gopls_init_options = {
  \   'ui.diagnostic.analyses': {
  \       'composites': v:false,
  \       'unusedparams': v:true,
  \       'unusedresult': v:true,
  \   },
  \}
<
  For a full list of supported analyzers, see:
  https://github.com/golang/tools/blob/master/gopls/doc/analyzers.md

                                              *ale-options.go_gopls_use_global*
                                                    *g:ale_go_gopls_use_global*
                                                    *b:ale_go_gopls_use_global*
go_gopls_use_global
g:ale_go_gopls_use_global
  Type: |String|
  Default: `get(g:, 'ale_use_global_executables', 0)`

  See |ale-integrations-local-executables|


===============================================================================
govet                                                            *ale-go-govet*

                                                 *ale-options.go_govet_options*
                                                       *g:ale_go_govet_options*
                                                       *b:ale_go_govet_options*
go_govet_options
g:ale_go_govet_options
  Type: |String|
  Default: `''`

  This variable can be set to pass additional options to the go vet linter.


===============================================================================
revive                                                          *ale-go-revive*

                                             *ale-options.go_revive_executable*
                                                   *g:ale_go_revive_executable*
                                                   *b:ale_go_revive_executable*
go_revive_executable
g:ale_go_revive_executable
  Type: |String|
  Default: `'revive'`

  This variable can be set to change the revive executable path.

                                                *ale-options.go_revive_options*
                                                      *g:ale_go_revive_options*
                                                      *b:ale_go_revive_options*
go_revive_options
g:ale_go_revive_options
  Type: |String|
  Default: `''`

  This variable can be set to pass additional options to the revive


===============================================================================
staticcheck                                                *ale-go-staticcheck*

                                        *ale-options.go_staticcheck_executable*
                                              *g:ale_go_staticcheck_executable*
                                              *b:ale_go_staticcheck_executable*
go_staticcheck_executable
g:ale_go_staticcheck_executable
  Type: |String|
  Default: `'staticcheck'`

  See |ale-integrations-local-executables|

  ALE will search for `staticcheck` in locally installed directories first by
  default, and fall back on a globally installed `staticcheck` if it can't be
  found otherwise.

                                           *ale-options.go_staticcheck_options*
                                                 *g:ale_go_staticcheck_options*
                                                 *b:ale_go_staticcheck_options*
go_staticcheck_options
g:ale_go_staticcheck_options
  Type: |String|
  Default: `''`

  This variable can be set to pass additional options to the staticcheck
  linter.

                                      *ale-options.go_staticcheck_lint_package*
                                            *g:ale_go_staticcheck_lint_package*
                                            *b:ale_go_staticcheck_lint_package*
go_staticcheck_lint_package
g:ale_go_staticcheck_lint_package
  Type: |Number|
  Default: `1`

  When set to `1`, the whole Go package will be checked instead of only the
  current file.

                                        *ale-options.go_staticcheck_use_global*
                                              *g:ale_go_staticcheck_use_global*
                                              *b:ale_go_staticcheck_use_global*
go_staticcheck_use_global
g:ale_go_staticcheck_use_global
  Type: |String|
  Default: `get(g:, 'ale_use_global_executables', 0)`

  See |ale-integrations-local-executables|


===============================================================================
  vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: