File: README.md

package info (click to toggle)
golang-github-fortytw2-leaktest 0.0~git20160923.0.0db74e8-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 60 kB
  • ctags: 10
  • sloc: makefile: 2
file content (36 lines) | stat: -rw-r--r-- 816 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Leaktest [![Build Status](https://travis-ci.org/fortytw2/leaktest.svg?branch=master)](https://travis-ci.org/fortytw2/leaktest)
------

Refactored, tested variant of the goroutine leak detector found in both `net/http` tests and the `cockroachdb`
source tree.

Takes a snapshot of running goroutines at the start of a test, and at the end -
compares the two and *voila*. Ignores runtime/sys goroutines. Doesn't play nice
with `t.Parallel()` right now, but there are plans to do so.

### Installation

```
go get -u github.com/fortytw2/leaktest
```

### Example

This test fails, because it leaks a goroutine :o

```go
func TestPool(t *testing.T) {
	defer leaktest.Check(t)()

    go func() {
        for {
            time.Sleep(time.Second)
        }
    }()
}
```


LICENSE
------
Same BSD-style as Go, see LICENSE