Skip to content

Commit

Permalink
Merge pull request #567 from fatih/fix-build-error
Browse files Browse the repository at this point in the history
cmd: /dev/null is not supported with go build
  • Loading branch information
fatih committed Oct 18, 2015
2 parents 17b57b9 + 66f7e55 commit b429c5c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion autoload/go/cmd.vim
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ function! go#cmd#Build(bang, ...)
let old_gopath = $GOPATH
let $GOPATH = go#path#Detect()

let l:tmpname = tempname()

if v:shell_error
let &makeprg = "go build . errors"
else
" :make expands '%' and '#' wildcards, so they must also be escaped
let goargs = go#util#Shelljoin(map(copy(a:000), "expand(v:val)"), 1)
let gofiles = go#util#Shelljoin(go#tool#Files(), 1)
let &makeprg = "go build -o /dev/null " . goargs . ' ' . gofiles
let &makeprg = "go build -o " . l:tmpname . ' ' . goargs . ' ' . gofiles
endif

echon "vim-go: " | echohl Identifier | echon "building ..."| echohl None
Expand All @@ -45,6 +47,7 @@ function! go#cmd#Build(bang, ...)
redraws! | echon "vim-go: " | echohl Function | echon "[build] SUCCESS"| echohl None
endif

call delete(l:tmpname)
let &makeprg = default_makeprg
let $GOPATH = old_gopath
endfunction
Expand Down

0 comments on commit b429c5c

Please sign in to comment.