Skip to content

Commit

Permalink
GoTest: Output original message on failure return code
Browse files Browse the repository at this point in the history
When using jobcontrol, assume FAILED if return code is >0. Only prints the first line.
  • Loading branch information
shazow committed Jan 3, 2016
1 parent 8ddcf6d commit 608c866
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
3 changes: 3 additions & 0 deletions autoload/go/cmd.vim
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ function! go#cmd#Test(bang, compile, ...)
call go#list#Window(len(errors))
if !empty(errors) && !a:bang
call go#list#JumpToFirst()
elseif empty(errors)
" failed to parse errors, output the original content
call go#util#EchoError(out)
endif
echon "vim-go: " | echohl ErrorMsg | echon "[test] FAIL" | echohl None
else
Expand Down
13 changes: 5 additions & 8 deletions autoload/go/jobcontrol.vim
Original file line number Diff line number Diff line change
Expand Up @@ -93,28 +93,25 @@ endfunction
" it'll be closed.
function! s:on_exit(job_id, data)
let std_combined = self.stderr + self.stdout
if empty(std_combined)
if a:data == 0
call go#list#Clean()
call go#list#Window()

let self.state = "SUCCESS"
return
endif

let self.state = "FAILED"

let errors = go#tool#ParseErrors(std_combined)
let errors = go#tool#FilterValids(errors)

if !len(errors)
" no errors could be past, just return
call go#list#Clean()
call go#list#Window()

let self.state = "SUCCESS"
" failed to parse errors, output the original content
call go#util#EchoError(std_combined[0])
return
endif

let self.state = "FAILED"

" if we are still in the same windows show the list
if self.winnr == winnr()
call go#list#Populate(errors)
Expand Down

0 comments on commit 608c866

Please sign in to comment.