Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GoTest: Output original message on failure return code #676

Merged
merged 1 commit into from
Jan 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
15 changes: 6 additions & 9 deletions autoload/go/jobcontrol.vim
Original file line number Diff line number Diff line change
Expand Up @@ -91,30 +91,27 @@ endfunction
" references and also displaying errors in the quickfix window collected by
" on_stderr handler. If there are no errors and a quickfix window is open,
" it'll be closed.
function! s:on_exit(job_id, data)
function! s:on_exit(job_id, exit_status)
let std_combined = self.stderr + self.stdout
if empty(std_combined)
if a:exit_status == 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])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is causing errors when std_combined is empty.

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