sarama icon indicating copy to clipboard operation
sarama copied to clipboard

Error building docker with Shopify Sarama

Open erangaeb opened this issue 3 years ago • 3 comments

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"]

erangaeb avatar Sep 23 '21 19:09 erangaeb

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...

david-bergman avatar Oct 01 '21 07:10 david-bergman

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.

dnwe avatar Oct 01 '21 08:10 dnwe

Updating go version to 1.16 worked for me

abhijeetdutta avatar Jun 09 '22 05:06 abhijeetdutta

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.

github-actions[bot] avatar Aug 19 '23 22:08 github-actions[bot]

Closing as fixed

dnwe avatar Aug 25 '23 22:08 dnwe