adjust / rmq

Message queue system written in Go and backed by Redis
MIT License
1.57k stars 206 forks source link

error while getting rmq package into docker image. #87

Closed nehaboob closed 4 years ago

nehaboob commented 4 years ago

Getting below error while getting rmq package into docker image. Let me know if more information is required.

$docker build --no-cache  -f Dockerfile-rmq -t test test
....
Step 4/4 : RUN go get -u github.com/adjust/rmq
 ---> Running in f3280e2aa42d
package github.com/go-redis/redis/v7: cannot find package "github.com/go-redis/redis/v7" in any of:
    /usr/local/go/src/github.com/go-redis/redis/v7 (from $GOROOT)
    /go/src/github.com/go-redis/redis/v7 (from $GOPATH)

$ docker --version
Docker version 19.03.8, build afacb8b7f0

Dockerfile-rmq
FROM golang:1.14.2-alpine3.11

ENV GOBIN=/go/bin

RUN apk update && apk upgrade && \
    apk add --no-cache git openssh

RUN go get -u github.com/adjust/rmq
wellle commented 4 years ago

@nehaboob: The main challenge here seems that you are

  1. not using Go modules yet and
  2. still use go get instead of a dependency management tool like https://github.com/golang/dep

In #82 we updated rmq to embrace Go modules. In your case your go get call will always just fetch the latest versions of all your dependencies, which could be considered dangerous with dependencies which support Go modules, like rmq and the underlying https://github.com/go-redis/redis.

So the concrete issue here is that go-redis just switch their latest version to be go-redis/v8, while rmq/v2 still uses go-redis/v7.

Here are some things you can try:

Hope that helps.

nehaboob commented 4 years ago

@wellle thanks for the suggestion, it was really helpful. I updated my code to use go modules and its working fine now.