From 55827a9493aa88ee6cffb8bce2d2cdee955d24fa Mon Sep 17 00:00:00 2001 From: dzhou121 Date: Thu, 22 Dec 2016 20:10:21 +0800 Subject: [PATCH] add go build for build errors (#180) * add go build for build errors * Add go build to doc and README * Improvement for Go build Go build works on package level, so copy over the other files that belong to the same package to the temp folder as well. * revert back to simple go build * change gobuild script var name --- README.md | 2 +- ale_linters/go/gobuild.vim | 17 +++++++++++++++++ doc/ale.txt | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 ale_linters/go/gobuild.vim diff --git a/README.md b/README.md index 2a6c9ac..be07bdf 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ name. That seems to be the fairest way to arrange this table. | Elixir | [credo](https://github.com/rrrene/credo) | | Elm | [elm-make](https://github.com/elm-lang/elm-make) | | Fortran | [gcc](https://gcc.gnu.org/) | -| Go | [gofmt -e](https://golang.org/cmd/gofmt/), [go vet](https://golang.org/cmd/vet/), [golint](https://godoc.org/github.com/golang/lint) | +| Go | [gofmt -e](https://golang.org/cmd/gofmt/), [go vet](https://golang.org/cmd/vet/), [golint](https://godoc.org/github.com/golang/lint), [go build](https://golang.org/cmd/go/) | | Haskell | [ghc](https://www.haskell.org/ghc/), [hlint](https://hackage.haskell.org/package/hlint) | | HTML | [HTMLHint](http://htmlhint.com/), [tidy](http://www.html-tidy.org/) | | JavaScript | [eslint](http://eslint.org/), [jscs](http://jscs.info/), [jshint](http://jshint.com/), [FlowType](https://flowtype.org/) | diff --git a/ale_linters/go/gobuild.vim b/ale_linters/go/gobuild.vim new file mode 100644 index 0000000..1fd6b4c --- /dev/null +++ b/ale_linters/go/gobuild.vim @@ -0,0 +1,17 @@ +" Author: dzhou121 +" Description: go build for Go files + +function! s:FindGobuildScript() abort + return g:ale#util#stdin_wrapper . ' .go go build' +endfunction + +let g:ale#util#gobuild_script = +\ get(g:, 'ale_go_gobuild_script', s:FindGobuildScript()) + +call ale#linter#Define('go', { +\ 'name': 'go build', +\ 'output_stream': 'stderr', +\ 'executable': 'go', +\ 'command': g:ale#util#gobuild_script, +\ 'callback': 'ale#handlers#HandleUnixFormatAsError', +\}) diff --git a/doc/ale.txt b/doc/ale.txt index 3d8412e..e181fa4 100644 --- a/doc/ale.txt +++ b/doc/ale.txt @@ -73,7 +73,7 @@ The following languages and tools are supported. * Elixir: 'credo' * Elm: 'elm-make' * Fortran: 'gcc' -* Go: 'gofmt -e', 'go vet', 'golint' +* Go: 'gofmt -e', 'go vet', 'golint', 'go build' * Haskell: 'ghc', 'hlint' * HTML: 'HTMLHint', 'tidy' * JavaScript: 'eslint', 'jscs', 'jshint', 'flow'