Skip to content

Commit a96cdc5

Browse files
committed
support and test against Go 1.11
Update errorformat strings for go test for Go 1.11 test output while maintaining compatibility with Go 1.10 test output, too. The changes were validated locally by running the tests in vim-go-test containers based on the respective versions of Go. I investigated trying to use the json support, but it doesn't offer any real value for us yet. I may revisit it later. Update the go vet expecations; one of the strings changed. Update to the Dockerfile base image and travis to use Go 1.11.
1 parent 53d36f4 commit a96cdc5

File tree

4 files changed

+26
-15
lines changed

4 files changed

+26
-15
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: go
22
go:
3-
- 1.10.x
3+
- 1.11
44
notifications:
55
email: false
66
matrix:

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.10.1
1+
FROM golang:1.11
22

33
RUN apt-get update -y && \
44
apt-get install -y build-essential curl git libncurses5-dev python3-pip && \

autoload/go/test.vim

+23-12
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,12 @@ function! s:errorformat() abort
152152
" each level of test indents the test output 4 spaces. Capturing groups
153153
" (e.g. \(\)) cannot be used in an errorformat, but non-capturing groups can
154154
" (e.g. \%(\)).
155-
let indent = '%\\%( %\\)%#'
155+
let indent = '%\\%( %\\)'
156156

157157
" ignore `go test -v` output for starting tests
158158
let format = "%-G=== RUN %.%#"
159159
" ignore `go test -v` output for passing tests
160-
let format .= ",%-G" . indent . "--- PASS: %.%#"
160+
let format .= ",%-G" . indent . "%#--- PASS: %.%#"
161161

162162
" Match failure lines.
163163
"
@@ -167,24 +167,25 @@ function! s:errorformat() abort
167167
" e.g.:
168168
" '--- FAIL: TestSomething (0.00s)'
169169
if show_name
170-
let format .= ",%G" . indent . "--- FAIL: %m (%.%#)"
170+
let format .= ",%G" . indent . "%#--- FAIL: %m (%.%#)"
171171
else
172-
let format .= ",%-G" . indent . "--- FAIL: %.%#"
172+
let format .= ",%-G" . indent . "%#--- FAIL: %.%#"
173173
endif
174174

175+
" Go 1.10 test output {{{1
175176
" Matches test output lines.
176177
"
177178
" All test output lines start with the test indentation and a tab, followed
178179
" by the filename, a colon, the line number, another colon, a space, and the
179180
" message. e.g.:
180181
" '\ttime_test.go:30: Likely problem: the time zone files have not been installed.'
181-
let format .= ",%A" . indent . "%\\t%\\+%f:%l: %m"
182+
let format .= ",%A" . indent . "%#%\\t%\\+%f:%l: %m"
182183
" also match lines that don't have a message (i.e. the message begins with a
183184
" newline or is the empty string):
184185
" e.g.:
185186
" t.Errorf("\ngot %v; want %v", actual, expected)
186187
" t.Error("")
187-
let format .= ",%A" . indent . "%\\t%\\+%f:%l: "
188+
let format .= ",%A" . indent . "%#%\\t%\\+%f:%l: "
188189

189190
" Match the 2nd and later lines of multi-line output. These lines are
190191
" indented the number of spaces for the level of nesting of the test,
@@ -197,7 +198,17 @@ function! s:errorformat() abort
197198
" indicate that they're multiple lines of output, but in that case the lines
198199
" get concatenated in the quickfix list, which is not what users typically
199200
" want when writing a newline into their test output.
200-
let format .= ",%G" . indent . "%\\t%\\{2}%m"
201+
let format .= ",%G" . indent . "%#%\\t%\\{2}%m"
202+
" }}}1
203+
204+
" Go 1.11 test output {{{1
205+
" Match test output lines similarly to Go 1.10 test output lines, but they
206+
" use an indent level where the Go 1.10 test output uses tabs, so they'll
207+
" always have at least one level indentation...
208+
let format .= ",%A" . indent . "%\\+%f:%l: %m"
209+
let format .= ",%A" . indent . "%\\+%f:%l: "
210+
let format .= ",%G" . indent . "%\\{2\\,}%m"
211+
" }}}1
201212

202213
" set the format for panics.
203214

@@ -261,16 +272,16 @@ function! s:errorformat() abort
261272
let format .= ",%-Cexit status %[0-9]%\\+"
262273
"let format .= ",exit status %[0-9]%\\+"
263274

264-
" Match and ignore exit failure lines whether part of a multi-line message
275+
" Match and ignore failure lines whether part of a multi-line message
265276
" or not, because these lines sometimes come before and sometimes after
266277
" panic stacktraces.
267278
let format .= ",%-CFAIL%\\t%.%#"
268279
"let format .= ",FAIL%\\t%.%#"
269280

270-
" match compiler errors
271-
" These are very smilar to errors from test output, but lack leading tabs
272-
" for the first line of an error, and subsequent lines only have one tab
273-
" instead of two.
281+
" match compiler errors.
282+
" These are very smilar to errors from <=go1.10 test output, but lack
283+
" leading tabs for the first line of an error, and subsequent lines only
284+
" have one tab instead of two.
274285
let format .= ",%A%f:%l:%c: %m"
275286
let format .= ",%A%f:%l: %m"
276287
" It would be nice if this weren't necessary, but panic lines from tests are

autoload/go/test_test.vim

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ endfunc
7474

7575
func! Test_GoTestVet() abort
7676
let expected = [
77-
\ {'lnum': 6, 'bufnr': 16, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'Errorf format %v reads arg #1, but call has only 0 args'},
77+
\ {'lnum': 6, 'bufnr': 16, 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'Errorf format %v reads arg #1, but call has 0 args'},
7878
\ ]
7979
call s:test('veterror/veterror.go', expected)
8080
endfunc

0 commit comments

Comments
 (0)