vim-go icon indicating copy to clipboard operation
vim-go copied to clipboard

GoRun shows a blank line in quickfix window when panic is received

Open presmihaylov opened this issue 6 years ago • 3 comments

What did you do? (required: The issue will be closed when not provided)

Given the following source file:

package main

import "fmt"

func main() {
	fmt.Println("vim-go")
	panic("err")
}

I typed :GoRun.

What did you expect to happen?

Quickfix window opens with line that failed + output showing the panic.

What happened instead?

Quickfix window opens with a blank line & pointer to line that failed. image

Configuration (MUST fill this out):

vim-go version:

vim-go @ 3e9a292

vimrc you used to reproduce (use a minimal vimrc with other plugins disabled; do not link to a 2,000 line vimrc):

vimrc
""" -------------------- vim-go -------------------------
" all errors are shown in the quickfix window
let g:go_list_type = "quickfix"

" automatically add import paths when saving file "let g:go_fmt_command = "goimports"

" enable syntax highlighting let g:go_highlight_types = 1 let g:go_highlight_fields = 1 let g:go_highlight_functions = 1 let g:go_highlight_function_calls = 1 let g:go_highlight_operators = 1 let g:go_highlight_extra_types = 1 let g:go_highlight_build_constraints = 1 let g:go_highlight_generate_tags = 1

" enable go metalinter let g:go_metalinter_enabled = ['vet', 'golint', 'errcheck']

" let g:go_metalinter_autosave_enabled = ['vet', 'golint', 'errcheck'] let g:go_metalinter_autosave_enabled = ['vet', 'errcheck'] let g:go_metalinter_autosave = 1

" automatically show GoInfo output " let g:go_auto_type_info = 1

" automatically highlight variable your cursor is on let g:go_auto_sameids = 1

" adjust quickfix window height let g:go_list_height = 8

" terminal opens as a horizontal split below the main window let g:go_term_mode = "split above"

" More verbose output on failed tests in quickfix window let g:go_test_show_name = 1

Vim version (first three lines from :version):

NVIM v0.3.4
Build type: Release
LuaJIT 2.1.0-beta3

Go version (go version):

go version go1.11.4 linux/amd64

Go environment

go env Output:

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/pmihaylov/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/pmihaylov/programming/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build861316129=/tmp/go-build -gno-record-gcc-switches"

presmihaylov avatar May 30 '19 05:05 presmihaylov

vim-go won't parse the panic output, because there isn't a reliable way to tell non-panic output from the panic output, especially if there's a substantial output.

vim-go really shouldn't show any errors unless the exit code from go run is 2; that's the exit code when there's a problem compiling what's being go run. If the exit code is 1, then there was an error at runtime.

bhcleek avatar Jun 01 '19 01:06 bhcleek

Can we at least then show a generic message in the quickfix window line, such as runtime error occurred.

I actually noticed that vim-go showed the line, where the runtime error occurred while writing this issue. I believe an explicit message will make it easier for users to detect where the problem is rather than a blank line.

presmihaylov avatar Jun 02 '19 07:06 presmihaylov

Yes. I'm planning to refactor the :GoRun so that it will parse compilation errors if there are any, but leave the runtime errors as output in the usual window that holds the output.

bhcleek avatar Jun 02 '19 16:06 bhcleek