You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This change improves the way we compile a Go test. Previously we would
build a test binary to catch any build errors. A callback was then
responsible to delete the test binary after showing build errors (if
there were any).
This could be racy though, because if the tests lasts long and we quit
early, the callback to clean the binary file would never run. So we
would end up with artifacts in our working directory.
To fix the issue we're going to tell to the `go` tool to run a specific,
unique function. We're passing a unique identifier as a function name
(which is a randomly generated), i.e:
```
go test -run "F97CC94D-4414-41CF-A185-A077F645DF24"
testing: warning: no tests to run
PASS
ok demo 0.006s
```
This will cause the go tool to build
the test file and then try to run the test function. Because there is no
such test function, it'll silently quit with zero exit status. As a side
effect it'll compile the test file, so we're able to catch any build
errors (if any)
fixesfatih#907
0 commit comments