summaryrefslogtreecommitdiff
path: root/autoload/ale/fixers/gofmt.vim
blob: b9cfbb586a261c619ccec1afbb83e98b67e25708 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
" Author: aliou <code@aliou.me>
" Description: Integration of gofmt with ALE.

call ale#Set('go_gofmt_executable', 'gofmt')
call ale#Set('go_gofmt_options', '')

function! ale#fixers#gofmt#Fix(buffer) abort
    let l:executable = ale#Var(a:buffer, 'go_gofmt_executable')
    let l:options = ale#Var(a:buffer, 'go_gofmt_options')
    let l:env = ale#go#EnvString(a:buffer)

    return {
    \   'command': l:env . ale#Escape(l:executable)
    \       . (empty(l:options) ? '' : ' ' . l:options)
    \}
endfunction