kothar / brotli-go

Not maintained -> see itch.io's more up-to-date fork 👉
https://github.com/itchio/go-brotli
MIT License
82 stars 9 forks source link

cgo argument has Go pointer to Go pointer (go 1.6) #31

Closed fasterthanlime closed 8 years ago

fasterthanlime commented 8 years ago

With

$ go version
go version go1.6rc2 windows/amd64

...running tests fail:

=== RUN   TestStreamDecompression
--- FAIL: TestStreamDecompression (0.05s)
panic: runtime error: cgo argument has Go pointer to Go pointer [recovered]
        panic: runtime error: cgo argument has Go pointer to Go pointer

goroutine 5 [running]:
testing.tRunner.func1(0xc082076000)
        C:/Go/src/testing/testing.go:467 +0x199
gopkg.in/kothar/brotli-go.v0/dec.NewBrotliReaderSize(0xb8a6b0, 0xc082007f80, 0x20000, 0xb8a6b0)
        C:/msys64/home/amwenger/Dev/go/src/gopkg.in/kothar/brotli-go.v0/dec/decode.go:208 +0x130
gopkg.in/kothar/brotli-go.v0/dec.NewBrotliReader(0xb8a6b0, 0xc082007f80, 0x758ff0)
        C:/msys64/home/amwenger/Dev/go/src/gopkg.in/kothar/brotli-go.v0/dec/decode.go:195 +0x3b
gopkg.in/kothar/brotli-go.v0/dec.TestStreamDecompression(0xc082076000)
        C:/msys64/home/amwenger/Dev/go/src/gopkg.in/kothar/brotli-go.v0/dec/decode_test.go:28 +0x3c5
testing.tRunner(0xc082076000, 0x6ba5c0)
        C:/Go/src/testing/testing.go:473 +0x9f
created by testing.RunTests
        C:/Go/src/testing/testing.go:582 +0x899
FAIL    gopkg.in/kothar/brotli-go.v0/dec        0.140s

I'm starting to think that we should wrap the brotli interface into something sane, ie. something that returns number of bytes consumed, etc. rather than moving around a bunch of pointers.

kothar commented 8 years ago

Sorry, meant to push that to a branch first, but tests pass with go1.6 for me - thoughts?

fasterthanlime commented 8 years ago

Seems to work fine, thanks for the fix! :stars: