stoewer/go-nakadi

Go 1.9 support

Closed this issue · 3 comments

The library should be tested with Go 1.9 and tests on travis CI should run and pass with Go 1.8 and 1.9.

go:
- 1.8
- 1.9

I'd be happy to help with this. I do have a question around the use of go vet -race . though. In Go 1.9 this no longer seems to be an option. The Data Race Detector documentation seems to suggest running this as part of the tests with go test -race.

If I make this switch, the resulting race conditions detected cause the builds to fail. An example of one such failure is shown below. There are several others.

==================
WARNING: DATA RACE
Read at 0x000000ba5574 by goroutine 64:
  github.com/billglover/go-nakadi.(*StreamAPI).startStream()
      github.com/billglover/go-nakadi/_test/_obj_test/streams.go:183 +0xc16
Previous write at 0x000000ba5574 by goroutine 55:
  github.com/billglover/go-nakadi.(*StreamAPI).startStream()
      github.com/billglover/go-nakadi/_test/_obj_test/streams.go:183 +0xc33
Goroutine 64 (running) created at:
  github.com/billglover/go-nakadi.setupMockStream()
      /home/travis/gopath/src/github.com/billglover/go-nakadi/streams_test.go:233 +0x705
  github.com/billglover/go-nakadi.TestStreamAPI_startStream()
      /home/travis/gopath/src/github.com/billglover/go-nakadi/streams_test.go:19 +0xf2
  testing.tRunner()
      /home/travis/.gimme/versions/go1.8.linux.amd64/src/testing/testing.go:657 +0x107
Goroutine 55 (running) created at:
  github.com/billglover/go-nakadi.NewStream()
      github.com/billglover/go-nakadi/_test/_obj_test/streams.go:98 +0x6db
  github.com/billglover/go-nakadi.TestIntegrationStreamAPI()
      /home/travis/gopath/src/github.com/billglover/go-nakadi/streams_integration_test.go:34 +0x8dc
  testing.tRunner()
      /home/travis/.gimme/versions/go1.8.linux.amd64/src/testing/testing.go:657 +0x107
==================
--- FAIL: TestStreamAPI_startStream (0.10s)
	testing.go:610: race detected during execution of test

These failures exist both with Go 1.8 and Go 1.9. How would we like to handle these?

  • treat data races as warnings and don't fail the builds
  • figure out how to keep the current behaviour for Go1.8 but let Go1.9 build fail
  • don't run -race detection on either build
  • add the race detection on both Go 1.8 and 1.9 and raise new issues for each race condition found

I'm not too familiar with travis-ci but assume it is possible to run different tests for each version of Go.

Thank you for looking into this issue 👍

In the scope of this issue here I would go for:

don't run -race detection on either build

I created a separate issue (see #14) to deal with the race conditions in tests.

Thanks for that. I'll have something over today. If I can add more detail to #14 whilst doing this I will.