Description
What version of Go are you using (go version
)?
$ go version go version go1.17 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOINSECURE="" GOOS="darwin" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/Cellar/go/1.17.0/libexec" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/Cellar/go/1.17.0/libexec/pkg/tool/darwin_amd64" GOVCS="" GOVERSION="go1.17" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/dev/null" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/h1/qnz0z93n4_7fymcgs9wd8ls00000gn/T/go-build2980224056=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
I trying to use go compress/gzip package to unzip this file.
But program pop me an error and then use gzip -d -k server.data I can get the actually data.
gzip -d -k server.data.gz gzip: stdin: decompression OK, trailing garbage ignored.
Then I looking into what is happened then I found this compress file include extra data.
Look back in go standard package code I did not see any code handle compress file extra data instead trying to use remaining data for next compress file (when MultipleStream is True).
Gzip file format documentation reference (from stackoverflow): https://stackoverflow.com/questions/4928560/how-can-i-work-with-gzip-files-which-contain-extra-data
Fully example code here: https://github.com/kunsonx/go-reproduce-data/blob/master/test-gzip-without-handle-extra-data.go
What did you expect to see?
No errors pop. compress file extra data handled.
What did you see instead?
error : "gzip: invalid header"