Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit adds a test that checks for goroutine leaks in the `workerpool` package, and also fixes two goroutine leaks. There is unfortunately no easy way of running `goleak` before every test without either a lot of copy-paste, or additional code to ensure every test file has a `TestMain` function. A leaked goroutine will produce the following error with `goleak`: ``` goleak: Errors on successful test run: found unexpected goroutines: [Goroutine 7 in state chan receive, with github.com/nlnwa/warchaeology/internal/workerpool .New.func1 on top of the stack: goroutine 7 [chan receive]: github.com/nlnwa/warchaeology/internal/workerpool. New.func1(0xc00008a1e0) ./warchaeology/internal/workerpool/workerpool.go: 23 +0x66 created by github.com/nlnwa/warchaeology/internal/workerpool.New in goroutine 6 ./warchaeology/internal/workerpool/workerpool.go: 22 +0x85 ] FAIL github.com/nlnwa/warchaeology/internal/workerpool 0.450s FAIL ```
- Loading branch information