Sops: Unable to `go get` sops in docker

Created on 11 Dec 2019  Â·  4Comments  Â·  Source: mozilla/sops

With a simple docker file I'm unable to go get sops.

FROM golang:1.13-buster
ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update && apt-get install -y locales \
    && localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
ENV LANG en_US.utf8

ENV SOPS_VERSION v3.5.0
RUN go get -u go.mozilla.org/sops/v3/cmd/sops
RUN cd $GOPATH/src/go.mozilla.org/sops/
RUN git checkout tags/$(SOPS_VERSION)
RUN make install

this results in:

Step i/n : RUN go get go.mozilla.org/sops/v3/cmd/sops
 ---> Running in xxx
package go.mozilla.org/sops/v3/cmd/sops: unrecognized import path "go.mozilla.org/sops/v3/cmd/sops" (parse https://go.mozilla.org/sops/v3/cmd/sops?go-get=1: no go-import meta tags ())

Most helpful comment

This worked for me.

RUN go get -u go.mozilla.org/sops/v3 \
  && cd $GOPATH/src/go.mozilla.org/sops/v3/cmd/sops \
  && git checkout tags/v3.5.0 \
  && go install go.mozilla.org/sops/v3/cmd/sops \
  && sops --version

All 4 comments

Same issue here:

go get go.mozilla.org/sops/v3/decrypt
package go.mozilla.org/sops/v3/decrypt: unrecognized import path 
"go.mozilla.org/sops/v3/decrypt" (parse https://go.mozilla.org/sops/v3/decrypt?go-get=1:
 no go-import meta tags ())

This worked for me.

RUN go get -u go.mozilla.org/sops/v3 \
  && cd $GOPATH/src/go.mozilla.org/sops/v3/cmd/sops \
  && git checkout tags/v3.5.0 \
  && go install go.mozilla.org/sops/v3/cmd/sops \
  && sops --version

I ran into the same issue when running on a regular VM host (following the docs outlined here: https://github.com/mozilla/sops/tree/83a354e92fd5d0be1d5bdcfe7cf0b7f68f954ed9#12development-branch )

➜  src go get -u go.mozilla.org/sops/v3/cmd/sops
package go.mozilla.org/sops/v3/cmd/sops: unrecognized import path "go.mozilla.org/sops/v3/cmd/sops" (parse https://go.mozilla.org/sops/v3/cmd/sops?go-get=1: no go-import meta tags ())

It works when I do a less-specific path for go get

➜  src go get -u go.mozilla.org/sops
package go.mozilla.org/sops: code in directory /home/jnaulty/go/src/go.mozilla.org/sops expects import "go.mozilla.org/sops/v3"
➜  src 

I'm also seeing issues with the build process that I was using for a while.

For anyone running into issues, the build process I'm using now in the diff below, ensures that all the golang dependencies get pulled in as part of the make install process.
Then I just rebuild / reinstall sops as static binary now that all the go deps are in place.

https://github.com/cmosetick/k8s-kubectl/commit/f538924c87e25b4eecb30773c403fd0e36d98080#diff-3254677a7917c6c01f55212f86c57fbf

Was this page helpful?
0 / 5 - 0 ratings

Related issues

benjefferies picture benjefferies  Â·  6Comments

mrgleeco picture mrgleeco  Â·  7Comments

max-wittig picture max-wittig  Â·  3Comments

rpappalax picture rpappalax  Â·  5Comments

coretemp picture coretemp  Â·  5Comments