gotestfmt
gotestfmt copied to clipboard
`go: downloading` lines after JSON causes panic.
Thank you for this fantastic tool! We have been using it for Pion and has saved me significant time already :) reading test logs without it is terrible.
I am using go-acc
and in some cases will generate go: downloading
entries after JSON output. It causes this panic.
panic: unexpected output encountered: go: downloading github.com/stretchr/testify v1.7.1 (Did you use -json on go test?)
goroutine 7 [running]:
github.com/haveyoudebuggedit/gotestfmt/v2/parser.parse(0x0?, 0xc000070540, 0xc0000705a0, 0xc000070600, 0xc000070660)
/home/sean/go/pkg/mod/github.com/haveyoudebuggedit/gotestfmt/[email protected]/parser/parse.go:165 +0x1125
created by github.com/haveyoudebuggedit/gotestfmt/v2/parser.Parse
/home/sean/go/pkg/mod/github.com/haveyoudebuggedit/gotestfmt/[email protected]/parser/parse.go:26 +0x10a
In your opinion is this a gotestfmt
or go-acc
bug? I have attached a reproduce as well.
gotest.log
Hello @Sean-Der thank you very much! This seems to be another case of go-acc
behaving slightly differently than go test, I couldn't reproduce it with go test
locally. (Not surprising, since the output is not well documented.)
I have to apologize in advance, this will require some rearchitecting, so I can't fix it as quickly as I usually fix bugs.
I also wonder to myself if it wouldn't be easier to include code coverage reporting in gotestfmt itself.
@janosdebugs no worries here I am not blocked :) grep -v
has me covered
👋 I ran into similar issue:
FAIL service.../repositories/cache [build failed]
causes panic too.
Its ugly because it hides the actual fail, and you have to run it without gotestfmt. This is the exact message:
panic: unexpected output encountered: # service..../repositories/cache [service...../repositories/cache.test] (Did you use -json on go test?)
goroutine 7 [running]:
github.com/gotesttools/gotestfmt/v2/parser.parse(0x0?, 0xc000020660, 0xc0000206c0, 0xc000020720, 0xc000020780)
/home/runner/go/pkg/mod/github.com/gotesttools/gotestfmt/[email protected]/parser/parse.go:166 +0x1125
created by github.com/gotesttools/gotestfmt/v2/parser.Parse
/home/runner/go/pkg/mod/github.com/gotesttools/gotestfmt/[email protected]/parser/parse.go:26 +0x10a
make: *** [Makefile:62: test-go] Error 2
Hello @lunemec can you please upload your go test -json output?
Hi @janosdebugs - this is the output there. The issue was using Go 1.18 with sync/atomic.Int32 which is available on 1.19 and higher. Here is the output:
2022-11-17T16:01:43.4131591Z # repo/service/repositories/cache [repo/service/repositories/
cache.test]
2022-11-17T16:01:43.4214306Z ##[error]services/cache/repository_test.go:42:42: undefined: atomic.Int32
2022-11-17T16:01:43.4217841Z ##[error]services/cache/repository_test.go:57:38: undefined: atomic.Int32
2022-11-17T16:01:43.4221677Z ##[error]services/cache/repository_test.go:72:40: undefined: atomic.Int32
2022-11-17T16:01:43.4224680Z ##[error]services/cache/repository_test.go:87:42: undefined: atomic.Int32
2022-11-17T16:01:43.4227611Z ##[error]services/cache/repository_test.go:102:44: undefined: atomic.Int32
2022-11-17T16:01:43.4412163Z {"Time":"2022-11-17T16:01:43.440837459Z","Action":"run","Package":"repo/services/service","Test":"TestSuite/TestCase"}
@lunemec do you have a custom TestMain
defined that alters the output? This doesn't look like the typical output of go test -json
, although I could be wrong.
Yes, we use https://github.com/stretchr/testify#suite-package but that seems to work for everything - except this that is.
Thank you, I'll try to reproduce it.