We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
go test -race -count 1000 -v . -run TestWriteRace
func TestWriteRace(t *testing.T) { outBuffer := &bytes.Buffer{} totalCount := 20 bar := New(totalCount) bar.Output = outBuffer bar.Start() var wg sync.WaitGroup for i := 0; i < totalCount; i++ { wg.Add(1) go func() { bar.Increment() time.Sleep(250 * time.Millisecond) wg.Done() }() } wg.Wait() bar.Finish() }
================== WARNING: DATA RACE Read at 0x00c420186358 by goroutine 31: runtime.slicecopy() /usr/local/Cellar/go/1.8/libexec/src/runtime/slice.go:160 +0x0 bytes.(*Buffer).grow() /usr/local/Cellar/go/1.8/libexec/src/bytes/buffer.go:110 +0x492 bytes.(*Buffer).Write() /usr/local/Cellar/go/1.8/libexec/src/bytes/buffer.go:137 +0x60 fmt.Fprintln() /usr/local/Cellar/go/1.8/libexec/src/fmt/print.go:248 +0xad gopkg.in/cheggaaa/pb%2ev1.(*ProgressBar).Finish.func1() /Users/jbean/gocode/src/gopkg.in/cheggaaa/pb.v1/pb.go:254 +0x141 sync.(*Once).Do() /usr/local/Cellar/go/1.8/libexec/src/sync/once.go:44 +0xe1 gopkg.in/cheggaaa/pb%2ev1.(*ProgressBar).Finish() /Users/jbean/gocode/src/gopkg.in/cheggaaa/pb.v1/pb.go:259 +0x8b gopkg.in/cheggaaa/pb%2ev1.TestWriteRace() /Users/jbean/gocode/src/gopkg.in/cheggaaa/pb.v1/pb_test.go:42 +0x1b8 testing.tRunner() /usr/local/Cellar/go/1.8/libexec/src/testing/testing.go:657 +0x107 Previous write at 0x00c420186358 by goroutine 32: runtime.slicecopy() /usr/local/Cellar/go/1.8/libexec/src/runtime/slice.go:160 +0x0 bytes.(*Buffer).Write() /usr/local/Cellar/go/1.8/libexec/src/bytes/buffer.go:138 +0xeb fmt.Fprint() /usr/local/Cellar/go/1.8/libexec/src/fmt/print.go:216 +0xad gopkg.in/cheggaaa/pb%2ev1.(*ProgressBar).write() /Users/jbean/gocode/src/gopkg.in/cheggaaa/pb.v1/pb.go:414 +0xa60 gopkg.in/cheggaaa/pb%2ev1.(*ProgressBar).Update() /Users/jbean/gocode/src/gopkg.in/cheggaaa/pb.v1/pb.go:445 +0x84 gopkg.in/cheggaaa/pb%2ev1.(*ProgressBar).refresher() /Users/jbean/gocode/src/gopkg.in/cheggaaa/pb.v1/pb.go:472 +0x130 Goroutine 31 (running) created at: testing.(*T).Run() /usr/local/Cellar/go/1.8/libexec/src/testing/testing.go:697 +0x543 testing.runTests.func1() /usr/local/Cellar/go/1.8/libexec/src/testing/testing.go:882 +0xaa testing.tRunner() /usr/local/Cellar/go/1.8/libexec/src/testing/testing.go:657 +0x107 testing.runTests() /usr/local/Cellar/go/1.8/libexec/src/testing/testing.go:888 +0x4e0 testing.(*M).Run() /usr/local/Cellar/go/1.8/libexec/src/testing/testing.go:822 +0x1c3 main.main() gopkg.in/cheggaaa/pb.v1/_test/_testmain.go:68 +0x20f Goroutine 32 (finished) created at: gopkg.in/cheggaaa/pb%2ev1.(*ProgressBar).Start() /Users/jbean/gocode/src/gopkg.in/cheggaaa/pb.v1/pb.go:135 +0x15a gopkg.in/cheggaaa/pb%2ev1.TestWriteRace() /Users/jbean/gocode/src/gopkg.in/cheggaaa/pb.v1/pb_test.go:31 +0xfa testing.tRunner() /usr/local/Cellar/go/1.8/libexec/src/testing/testing.go:657 +0x107
The text was updated successfully, but these errors were encountered:
No branches or pull requests
go test -race -count 1000 -v . -run TestWriteRace
The text was updated successfully, but these errors were encountered: