When I run go test -test.run=TestEncodeShortBuffer in the zk directory with Go 1.13 (currently in beta release), I get
--- FAIL: TestEncodeShortBuffer (0.00s)
panic: runtime error: slice bounds out of range [:4] with capacity 0 [recovered]
panic: runtime error: slice bounds out of range [:4] with capacity 0 [recovered]
panic: runtime error: slice bounds out of range [:4] with capacity 0
goroutine 7 [running]:
testing.tRunner.func1(0xc0000c2100)
/home/iant/go/src/testing/testing.go:874 +0x3a3
panic(0x5f8aa0, 0xc0000164c0)
/home/iant/go/src/runtime/panic.go:679 +0x1b2
github.com/samuel/go-zookeeper/zk.encodePacket.func1(0xc00005af30)
/home/iant/gopath/src/github.com/samuel/go-zookeeper/zk/structs.go:489 +0xf8
panic(0x5f8aa0, 0xc0000164c0)
/home/iant/go/src/runtime/panic.go:679 +0x1b2
github.com/samuel/go-zookeeper/zk.encodePacketValue(0x7a2b20, 0x0, 0x0, 0x5c2e60, 0xc00001a398, 0x185, 0x185, 0xc00006170e, 0x3)
/home/iant/gopath/src/github.com/samuel/go-zookeeper/zk/structs.go:534 +0x93c
github.com/samuel/go-zookeeper/zk.encodePacketValue(0x7a2b20, 0x0, 0x0, 0x5b8200, 0xc00001a398, 0x16, 0x787600, 0x7fb0de51a008, 0x0)
/home/iant/gopath/src/github.com/samuel/go-zookeeper/zk/structs.go:519 +0x3b1
github.com/samuel/go-zookeeper/zk.encodePacket(0x7a2b20, 0x0, 0x0, 0x5b8200, 0xc00001a398, 0x0, 0x0, 0x0)
/home/iant/gopath/src/github.com/samuel/go-zookeeper/zk/structs.go:498 +0x19f
github.com/samuel/go-zookeeper/zk.TestEncodeShortBuffer(0xc0000c2100)
/home/iant/gopath/src/github.com/samuel/go-zookeeper/zk/structs_test.go:57 +0x7a
testing.tRunner(0xc0000c2100, 0x621f18)
/home/iant/go/src/testing/testing.go:909 +0xc9
created by testing.(*T).Run
/home/iant/go/src/testing/testing.go:960 +0x350
exit status 2
FAIL github.com/samuel/go-zookeeper/zk 0.031s
The test passes with Go 1.12.
The problem is that the function encodePacket expects a specific exact panic error string. In 1.13, that string has changed to include more information.
Thanks for reporting this. It's now fixed in master. Bad choice on my part to match on the runtime error text, but to avoid changing behavior updated the check to work in Go 1.12 and 1.13beta1
When I run
go test -test.run=TestEncodeShortBuffer
in the zk directory with Go 1.13 (currently in beta release), I getThe test passes with Go 1.12.
The problem is that the function
encodePacket
expects a specific exact panic error string. In 1.13, that string has changed to include more information.