What version of Go are you using (go version)?
1.15
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (go env)?
go env Output
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\arn\AppData\Local\go-build
set GOENV=C:\Users\arn\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\arn\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\arn\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=c:\go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\arn\AppData\Local\Temp\go-build610476046=/tmp/go-build -gno-record-gcc-switches
What did you do?
func test() *image.Image {
resp, _ := httpClient.Get("https://media.giphy.com/media/URdTwRx7YNcoefXsoi/giphy.gif")
defer resp.Body.Close()
fmt.Println("decode started")
img, err := gif.Decode(resp.Body)
if err != nil {
fmt.Println(err)
panic("gif error")
}
fmt.Println("decoded")
return &img
}
What did you expect to see?
It should stop reading from the stream and return as soon as it is done decoding the first frame. Saves a lot of time and bandwidth for large animated gifs from the network.
What did you see instead?
reads the entire stream of an animated gif (4.5 MB in this case), taking over a minute for large gifs on a slow connection in this case
What version of Go are you using (
go version)?1.15
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env)?go envOutputWhat did you do?
func test() *image.Image { resp, _ := httpClient.Get("https://media.giphy.com/media/URdTwRx7YNcoefXsoi/giphy.gif") defer resp.Body.Close() fmt.Println("decode started") img, err := gif.Decode(resp.Body) if err != nil { fmt.Println(err) panic("gif error") } fmt.Println("decoded") return &img }What did you expect to see?
It should stop reading from the stream and return as soon as it is done decoding the first frame. Saves a lot of time and bandwidth for large animated gifs from the network.
What did you see instead?
reads the entire stream of an animated gif (4.5 MB in this case), taking over a minute for large gifs on a slow connection in this case