dominikh / go-mode.el

Emacs mode for the Go programming language
BSD 3-Clause "New" or "Revised" License
1.37k stars 209 forks source link

go-test compilation error pattern doesn't match Go 1.14 output #362

Open phst opened 4 years ago

phst commented 4 years ago

The output of go test -v has changed somewhat in Go 1.14. For example, with this /tmp/f/foo_test.go:

package foo_test

import "testing"

func Test(t *testing.T) {
    t.Error(1)
}

the Go 1.13 output is

=== RUN   Test
--- FAIL: Test (0.00s)
    foo_test.go:6: 1
FAIL
exit status 1
FAIL    _/tmp/f 0.010s

but the Go 1.14 output is

=== RUN   Test
    Test: foo_test.go:6: 1
--- FAIL: Test (0.00s)
FAIL
exit status 1
FAIL    _/tmp/f 0.011s

Note that the error message now has the prefix Test: (i.e. test name, colon, space). This is probably related to the change described at https://golang.org/doc/go1.14#go-test. However, the go-test pattern treats the entire Test: foo_test.go part as filename.

go-test should be adapted accordingly.

dominikh commented 2 years ago

I cannot reproduce this with go1.18-8ff254e30b:

=== RUN   Test
    sand_test.go:6: 1
--- FAIL: Test (0.00s)
FAIL
exit status 1
FAIL    example.com/sand2   0.001s
phst commented 2 years ago

Maybe this got fixed again by a change in Go 1.15 (https://go.dev/doc/go1.15#testing):

go test -v now groups output by test name, rather than printing the test name on each line.

It's probably still worth adding a unit test to ensure that Emacs correctly parses the test output.