]> git.madduck.net Git - etc/vim.git/blob - doc/ale-go.txt

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Squashed '.vim/bundle/ale/' content from commit 22185c4c
[etc/vim.git] / doc / ale-go.txt
1 ===============================================================================
2 ALE Go Integration                                             *ale-go-options*
3
4
5 ===============================================================================
6 Integration Information
7
8 ALE enables `gofmt`, `gopls` and `go vet` by default. It also supports `staticcheck`,
9 `go build, ``gosimple`, `golangserver`, and `golangci-lint.
10
11 To enable `golangci-lint`, update |g:ale_linters| as appropriate.
12 A possible configuration is to enable golangci-lint and `gofmt:
13 >
14   " Enable all of the linters you want for Go.
15   let g:ale_linters = {'go': ['golangci-lint', 'gofmt']}
16 <
17                                                  *ale-options.go_go_executable*
18                                                        *g:ale_go_go_executable*
19                                                        *b:ale_go_go_executable*
20 go_go_executable
21 g:ale_go_go_executable
22   Type: |String|
23   Default: `'go'`
24
25   The executable that will be run for the `gobuild` and `govet` linters, and
26   the `gomod` fixer.
27
28                                                    *ale-options.go_go111module*
29                                                          *g:ale_go_go111module*
30                                                          *b:ale_go_go111module*
31 go_go111module
32 g:ale_go_go111module
33   Type: |String|
34   Default: `''`
35
36   Override the value of the `$GO111MODULE` environment variable for
37   golang tools.
38
39
40 ===============================================================================
41 bingo                                                            *ale-go-bingo*
42
43                                               *ale-options.go_bingo_executable*
44                                                     *g:ale_go_bingo_executable*
45                                                     *b:ale_go_bingo_executable*
46 go_bingo_executable
47 g:ale_go_bingo_executable
48   Type: |String|
49   Default: `'bingo'`
50
51   Location of the bingo binary file.
52
53                                                  *ale-options.go_bingo_options*
54                                                        *g:ale_go_bingo_options*
55                                                        *b:ale_go_bingo_options*
56 go_bingo_options
57 g:ale_go_bingo_options
58   Type: |String|
59   Default: `''`
60
61
62 ===============================================================================
63 cspell                                                          *ale-go-cspell*
64
65 See |ale-cspell-options|
66
67
68 ===============================================================================
69 gobuild                                                        *ale-go-gobuild*
70
71                                                *ale-options.go_gobuild_options*
72                                                      *g:ale_go_gobuild_options*
73                                                      *b:ale_go_gobuild_options*
74 go_gobuild_options
75 g:ale_go_gobuild_options
76   Type: |String|
77   Default: `''`
78
79   This variable can be set to pass additional options to the gobuild linter.
80   They are injected directly after "go test".
81
82
83 ===============================================================================
84 gofmt                                                            *ale-go-gofmt*
85
86                                                  *ale-options.go_gofmt_options*
87                                                        *g:ale_go_gofmt_options*
88                                                        *b:ale_go_gofmt_options*
89 go_gofmt_options
90 g:ale_go_gofmt_options
91   Type: |String|
92   Default: `''`
93
94   This variable can be set to pass additional options to the gofmt fixer.
95
96
97 ===============================================================================
98 gofumpt                                                        *ale-go-gofumpt*
99
100                                             *ale-options.go_gofumpt_executable*
101                                                   *g:ale_go_gofumpt_executable*
102                                                   *b:ale_go_gofumpt_executable*
103 go_gofumpt_executable
104 g:ale_go_gofumpt_executable
105   Type: |String|
106   Default: `'gofumpt'`
107
108   Executable to run to use as the gofumpt fixer.
109
110                                                *ale-options.go_gofumpt_options*
111                                                      *g:ale_go_gofumpt_options*
112                                                      *b:ale_go_gofumpt_options*
113 go_gofumpt_options
114 g:ale_go_gofumpt_options
115   Type: |String|
116   Default: `''`
117
118   Options to pass to the gofumpt fixer.
119
120
121 ===============================================================================
122 golangci-lint                                            *ale-go-golangci-lint*
123
124 `golangci-lint` is a `lint_file` linter, which only lints files that are
125 written to disk. This differs from the default behavior of linting the buffer.
126 See: |ale-lint-file|
127
128                                       *ale-options.go_golangci_lint_executable*
129                                             *g:ale_go_golangci_lint_executable*
130                                             *b:ale_go_golangci_lint_executable*
131 go_golangci_lint_executable
132 g:ale_go_golangci_lint_executable
133   Type: |String|
134   Default: `'golangci-lint'`
135
136   The executable that will be run for golangci-lint.
137
138                                          *ale-options.go_golangci_lint_options*
139                                                *g:ale_go_golangci_lint_options*
140                                                *b:ale_go_golangci_lint_options*
141 go_golangci_lint_options
142 g:ale_go_golangci_lint_options
143   Type: |String|
144   Default: `''`
145
146   This variable can be changed to alter the command-line arguments to the
147   golangci-lint invocation.
148
149                                          *ale-options.go_golangci_lint_package*
150                                                *g:ale_go_golangci_lint_package*
151                                                *b:ale_go_golangci_lint_package*
152 go_golangci_lint_package
153 g:ale_go_golangci_lint_package
154   Type: |Number|
155   Default: `0`
156
157   When set to `1`, the whole Go package will be checked instead of only the
158   current file.
159
160
161 ===============================================================================
162 golangserver                                              *ale-go-golangserver*
163
164                                          *ale-options.go_langserver_executable*
165                                                *g:ale_go_langserver_executable*
166                                                *b:ale_go_langserver_executable*
167 go_langserver_executable
168 g:ale_go_langserver_executable
169   Type: |String|
170   Default: `'go-langserver'`
171
172   Location of the go-langserver binary file.
173
174                                             *ale-options.go_langserver_options*
175                                                   *g:ale_go_langserver_options*
176                                                   *b:ale_go_langserver_options*
177 go_langserver_options
178 g:ale_go_langserver_options
179   Type: |String|
180   Default: `''`
181
182   Additional options passed to the go-langserver command. Note that the
183   `-gocodecompletion` option is ignored because it is handled automatically
184   by the |g:ale_completion_enabled| variable.
185
186
187 ===============================================================================
188 golines                                                        *ale-go-golines*
189
190                                             *ale-options.go_golines_executable*
191                                                   *g:ale_go_golines_executable*
192                                                     *b:ale_go_lines_executable*
193 go_golines_executable
194 g:ale_go_golines_executable
195   Type: |String|
196   Default: `'golines'`
197
198   Location of the golines binary file
199
200                                                *ale-options.go_golines_options*
201                                                      *g:ale_go_golines_options*
202                                                      *b:ale_go_golines_options*
203 go_golines_options
204 g:ale_go_golines_options
205   Type: |String|
206   Default: `''`
207
208   Additional options passed to the golines command. By default golines has
209   --max-length=100 (lines above 100 characters will be wrapped)
210
211
212 ===============================================================================
213 gopls                                                            *ale-go-gopls*
214
215 gopls is the official Go language server, and is enabled for use with ALE by
216 default.
217
218 To install the latest stable version of `gopls` to your `$GOPATH`, try the
219 following command: >
220
221   GO111MODULE=on go get golang.org/x/tools/gopls@latest
222 <
223 If `$GOPATH` is readable by ALE, it should probably work without you having to
224 do anything else. See the `gopls` README file for more information:
225
226 https://github.com/golang/tools/blob/master/gopls/README.md
227
228
229 -------------------------------------------------------------------------------
230 Options
231                                               *ale-options.go_gopls_executable*
232                                                     *g:ale_go_gopls_executable*
233                                                     *b:ale_go_gopls_executable*
234 go_gopls_executable
235 g:ale_go_gopls_executable
236   Type: |String|
237   Default: `'gopls'`
238
239   See |ale-integrations-local-executables|
240
241   ALE will search for `gopls` in locally installed directories first by
242   default, and fall back on a globally installed `gopls` if it can't be found
243   otherwise.
244
245                                                  *ale-options.go_gopls_options*
246                                                        *g:ale_go_gopls_options*
247                                                        *b:ale_go_gopls_options*
248 go_gopls_options
249 g:ale_go_gopls_options
250   Type: |String|
251   Default: `''`
252
253   Command-line options passed to the gopls executable. See `gopls -h`.
254
255                                           *ale-options.go_gopls_fix_executable*
256                                                 *g:ale_go_gopls_fix_executable*
257                                                 *b:ale_go_gopls_fix_executable*
258 go_gopls_fix_executable
259 g:ale_go_gopls_fix_executable
260   Type: |String|
261   Default: `'gopls'`
262
263   Executable to run to use as the gopls fixer.
264
265                                              *ale-options.go_gopls_fix_options*
266                                                    *g:ale_go_gopls_fix_options*
267                                                    *b:ale_go_gopls_fix_options*
268 go_gopls_fix_options
269 g:ale_go_gopls_fix_options
270   Type: |String|
271   Default: `''`
272
273   Options to pass to the gopls fixer.
274
275                                             *ale-options.go_gopls_init_options*
276                                                   *g:ale_go_gopls_init_options*
277                                                   *b:ale_go_gopls_init_options*
278 go_gopls_init_options
279 g:ale_go_gopls_init_options
280   Type: |Dictionary|
281   Default: `{}`
282
283   LSP initialization options passed to gopls. This can be used to configure
284   the behaviour of gopls.
285
286   For example: >
287   let g:ale_go_gopls_init_options = {
288   \   'ui.diagnostic.analyses': {
289   \       'composites': v:false,
290   \       'unusedparams': v:true,
291   \       'unusedresult': v:true,
292   \   },
293   \}
294 <
295   For a full list of supported analyzers, see:
296   https://github.com/golang/tools/blob/master/gopls/doc/analyzers.md
297
298                                               *ale-options.go_gopls_use_global*
299                                                     *g:ale_go_gopls_use_global*
300                                                     *b:ale_go_gopls_use_global*
301 go_gopls_use_global
302 g:ale_go_gopls_use_global
303   Type: |String|
304   Default: `get(g:, 'ale_use_global_executables', 0)`
305
306   See |ale-integrations-local-executables|
307
308
309 ===============================================================================
310 govet                                                            *ale-go-govet*
311
312                                                  *ale-options.go_govet_options*
313                                                        *g:ale_go_govet_options*
314                                                        *b:ale_go_govet_options*
315 go_govet_options
316 g:ale_go_govet_options
317   Type: |String|
318   Default: `''`
319
320   This variable can be set to pass additional options to the go vet linter.
321
322
323 ===============================================================================
324 revive                                                          *ale-go-revive*
325
326                                              *ale-options.go_revive_executable*
327                                                    *g:ale_go_revive_executable*
328                                                    *b:ale_go_revive_executable*
329 go_revive_executable
330 g:ale_go_revive_executable
331   Type: |String|
332   Default: `'revive'`
333
334   This variable can be set to change the revive executable path.
335
336                                                 *ale-options.go_revive_options*
337                                                       *g:ale_go_revive_options*
338                                                       *b:ale_go_revive_options*
339 go_revive_options
340 g:ale_go_revive_options
341   Type: |String|
342   Default: `''`
343
344   This variable can be set to pass additional options to the revive
345
346
347 ===============================================================================
348 staticcheck                                                *ale-go-staticcheck*
349
350                                         *ale-options.go_staticcheck_executable*
351                                               *g:ale_go_staticcheck_executable*
352                                               *b:ale_go_staticcheck_executable*
353 go_staticcheck_executable
354 g:ale_go_staticcheck_executable
355   Type: |String|
356   Default: `'staticcheck'`
357
358   See |ale-integrations-local-executables|
359
360   ALE will search for `staticcheck` in locally installed directories first by
361   default, and fall back on a globally installed `staticcheck` if it can't be
362   found otherwise.
363
364                                            *ale-options.go_staticcheck_options*
365                                                  *g:ale_go_staticcheck_options*
366                                                  *b:ale_go_staticcheck_options*
367 go_staticcheck_options
368 g:ale_go_staticcheck_options
369   Type: |String|
370   Default: `''`
371
372   This variable can be set to pass additional options to the staticcheck
373   linter.
374
375                                       *ale-options.go_staticcheck_lint_package*
376                                             *g:ale_go_staticcheck_lint_package*
377                                             *b:ale_go_staticcheck_lint_package*
378 go_staticcheck_lint_package
379 g:ale_go_staticcheck_lint_package
380   Type: |Number|
381   Default: `1`
382
383   When set to `1`, the whole Go package will be checked instead of only the
384   current file.
385
386                                         *ale-options.go_staticcheck_use_global*
387                                               *g:ale_go_staticcheck_use_global*
388                                               *b:ale_go_staticcheck_use_global*
389 go_staticcheck_use_global
390 g:ale_go_staticcheck_use_global
391   Type: |String|
392   Default: `get(g:, 'ale_use_global_executables', 0)`
393
394   See |ale-integrations-local-executables|
395
396
397 ===============================================================================
398   vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: