sarama
sarama copied to clipboard
Error building docker with Shopify Sarama
I'm building docker image with Shopify Sarama
library. When install Sarama on golang:1.13
base image it giving me following error. I have tried with different based image versions(1.17
, 1.16
, 1.9
etc), but same error. Previously this image building was working fine. This error occurred when I have updated the docker version of the Mac. Currently I'm using Docker v20.10.8
=> ERROR [4/9] RUN go get github.com/Shopify/sarama 134.1s
------
> [4/9] RUN go get github.com/Shopify/sarama:
#7 133.3 # github.com/Shopify/sarama
#7 133.3 src/github.com/Shopify/sarama/config.go:678:37: undefined: io.Discard
#7 133.3 src/github.com/Shopify/sarama/decompress.go:43:10: undefined: io.ReadAll
#7 133.3 src/github.com/Shopify/sarama/decompress.go:55:10: undefined: io.ReadAll
#7 133.3 src/github.com/Shopify/sarama/sarama.go:89:29: undefined: io.Discard
Following is the Dockerfile
FROM golang:1.13
MAINTAINER Eranga Bandara ([email protected])
# install dependencies
RUN go get gopkg.in/mgo.v2
RUN go get github.com/gorilla/mux
RUN go get github.com/Shopify/sarama
RUN go get github.com/wvanbergen/kafka/consumergroup
RUN go get github.com/gorilla/handlers
# copy app
ADD . /app
WORKDIR /app
# build
RUN go build -o build/gateway src/*.go
# server running port
EXPOSE 8751
# .keys volume
VOLUME ["/app/.keys"]
ENTRYPOINT ["/app/docker-entrypoint.sh"]
HI @erangaeb I am experiencing the same issue , was working fine with version v1.29.1 and below, but its failing with the latest version v1.30.0 of Sarama
if you update your DockerFile
RUN go get github.com/Shopify/[email protected]
it should work
not sure why the new version is failing...
This error is because Sarama is tracking against supported versions of the Go toolchain + library (1.16.x+1.17.x) and so we've applied the changes necessary for the deprecation of ioutil that happened in Go 1.16 https://golang.org/doc/go1.16#ioutil
If you update your Dockerfile to be FROM golang:1.16
then your problem should go away.
Updating go version to 1.16 worked for me
Thank you for taking the time to raise this issue. However, it has not had any activity on it in the past 90 days and will be closed in 30 days if no updates occur. Please check if the main branch has already resolved the issue since it was raised. If you believe the issue is still valid and you would like input from the maintainers then please comment to ask for it to be reviewed.
Closing as fixed