title: In Docker, can't cd into directory installed with "go get"?
body: <p>I'm trying to build a Docker container which downloads the source of <a href="https://github.com/micromdm/scep" rel="nofollow noreferrer">https://github.com/micromdm/scep</a> and using the <code>go get</code> command and <code>cd</code>s into the resulting directory in order to perform some follow-up commands (namely, <code>make deps</code>, <code>make build</code>, and <code>COPY</code>ing the relevant resulting binary into the container's <code>PATH</code>).</p>
  
  <p>So far I've tried this <code>Dockerfile</code>:</p>
  
  <pre><code>FROM golang:latest
  ENV GO111MODULE on
  RUN ["go", "get", "github.com/micromdm/scep"]
  RUN cd $GOPATH/src/github.com/micromdm/scep
  </code></pre>
  
  <p>However, if I try to run this I get the following error:</p>
  
  <pre><code>&gt; docker build . --tag loadtest
  Sending build context to Docker daemon  4.608kB
  Step 1/4 : FROM golang:latest
   ---&gt; 52b59e9ead8e
  Step 2/4 : ENV GO111MODULE on
   ---&gt; Using cache
   ---&gt; 28335bf0142b
  Step 3/4 : RUN ["go", "get", "github.com/micromdm/scep"]
   ---&gt; Using cache
   ---&gt; 86760bf0c490
  Step 4/4 : RUN cd $GOPATH/src/github.com/micromdm/scep
   ---&gt; Running in b86fc3ab0ab8
  /bin/sh: 1: cd: can't cd to /go/src/github.com/micromdm/scep
  The command '/bin/sh -c cd $GOPATH/src/github.com/micromdm/scep' returned a non-zero code: 2
  </code></pre>
  
  <p>If I try the command without setting the <code>GO111MODULE</code> environment variable to <code>on</code>, I get his error:</p>
  
  <pre><code>&gt; docker build . --tag loadtest
  Sending build context to Docker daemon  4.608kB
  Step 1/3 : FROM golang:latest
   ---&gt; 52b59e9ead8e
  Step 2/3 : RUN ["go", "get", "github.com/micromdm/scep"]
   ---&gt; Running in 8cb54311a416
  package github.com/micromdm/scep: no Go files in /go/src/github.com/micromdm/scep
  The command 'go get github.com/micromdm/scep' returned a non-zero code: 1
  </code></pre>
  
  <p>Following <a href="https://github.com/ponzu-cms/ponzu/issues/204" rel="nofollow noreferrer">https://github.com/ponzu-cms/ponzu/issues/204</a>, I also tried running it with a <code>...</code> at the end,</p>
  
  <pre><code>FROM golang:latest
  RUN ["go", "get", "github.com/micromdm/scep/..."]
  RUN cd $GOPATH/src/github.com/micromdm/scep \
  </code></pre>
  
  <p>but this results in</p>
  
  <pre><code>&gt; docker build . --tag loadtest
  Sending build context to Docker daemon  4.608kB
  Step 1/3 : FROM golang:latest
   ---&gt; 52b59e9ead8e
  Step 2/3 : RUN ["go", "get", "github.com/micromdm/scep/..."]
   ---&gt; Running in 961bae3bb455
  # github.com/micromdm/scep/scep
  src/github.com/micromdm/scep/scep/scep.go:318:17: p7.EncryptionAlgorithm undefined (type *pkcs7.PKCS7 has no field or method EncryptionAlgorithm)
  src/github.com/micromdm/scep/scep/scep.go:449:26: too many arguments in call to pkcs7.Encrypt
  src/github.com/micromdm/scep/scep/scep.go:449:53: undefined: pkcs7.WithEncryptionAlgorithm
  src/github.com/micromdm/scep/scep/scep.go:542:26: too many arguments in call to pkcs7.Encrypt
  src/github.com/micromdm/scep/scep/scep.go:542:54: undefined: pkcs7.WithEncryptionAlgorithm
  The command 'go get github.com/micromdm/scep/...' returned a non-zero code: 2
  </code></pre>
  
  <p>Any ideas about how I could achieve downloading the package and <code>cd</code>ing into the resulting directory?</p>