-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Do not add log output to quickfix list #561
Conversation
Before this change a test that made a call to `log.Println` (or `Printf`, etc.) resulted in the line printed by `log` to be added to the quickfix window. This output: === RUN TestSayname 2015/10/08 13:48:45 log line --- FAIL: TestSayname (0.00s) testing_example_test.go:9: foobar FAIL exit status 1 FAIL github.com/mrnugget/testing_example 0.005s would result in these two lines to be added to the quickfix window. 2015/10/08 13:48:45 log line testing_example_test.go:9: foobar The regex that was responsible for this was meant to only parse the latter of these two lines, but it accidentally added the first line too. This commit changes the regex to add lines that have _at least_ one whitespace at the beginning, thus ignoring the log output.
Could this be something you enable or flag in? Log output can be very handy at times, as well as extremely annoying, particularly with the auto jump feature. But I feel this would be ideal as something one can opt in/out of...? |
I'm sure it could be enabled. In " [...]
elseif !empty(errors)
" Preserve indented lines.
" This comes up especially with multi-line test output.
if match(line, '^\s') >= 0
call add(errors, {"text": line})
endif
endif
" [...] This could be modified to always add every line of text to the quickfix window. Which is exactly what happens if you use But these lines are not added with a linenumber and a filename. Just the text, which would be the correct thing to do. The way I'd say let's fix it first and then look at how to enable all output in the quickfix window. |
I think that https://github.com/fatih/vim-go/pull/547/files is related to this issue, albeit it's triggered by building/running a Go program and not testing. But I think merging this change here would fix the problems in PR 547 too, with a much simpler solution. |
Okay, I just realized that this PR would break the behaviour of I think maybe the best approach would be to add a separate |
So, just to clarify: do not merge this, since it breaks the other commands. I'll keep this open for now, so maybe we can discuss this problem. But, if it's the better approach, we can move the discussion to #547. |
I ran into a problem where the output of
log.Println
was added to the quickfix window when some tests failed. Here is some example code the reproduce the issue:When the tests were run with
:GoTest
or:GoTest!
thelog.Println
line was included in the quickfix list, which looked like this:My guess was that the regex that's responsible for parsing the output was not meant to parse the log line, but only did so accidently.
So I changed the regex to only parse lines for filenames and linenumbers that begin with at least one whitespace (which log lines do not).
(See the commit message for more details)
What do you think? :)