Skip to content

Commit

Permalink
fix/test: t.Fatal should be called from g running the test or bench…
Browse files Browse the repository at this point in the history
…mark func

The linter complains: the goroutine calls T.Fatal, which must be called in the
same goroutine as the testSA2002(default).

testing.T.Fail will calls testing.common.FailNow(), this function will marks
the test failing and call runtime.GoExit(). Sure, it could let the calling
goroutine exit, but this is a misuse.

t.Fail should be used for marks the test failing and let the goroutine which
runs this test or the benchmark func exit. So, just use t.Error+return instead.
  • Loading branch information
hitzhangjie committed Aug 16, 2023
1 parent b894f41 commit c630864
Show file tree
Hide file tree
Showing 5 changed files with 1,559 additions and 1,532 deletions.
Loading

0 comments on commit c630864

Please sign in to comment.