title: Go mod folders not found in Docker
body: <p>I'm very new to go modules and am trying to take a project and update it to use them as they seem like a really great way to finally handle my dependencies. However, I'm having an issue getting things to build in Docker.</p>
  
  <p>I have a project with a <code>main.go</code> and a <code>go.mod</code> file (which references both private/local repos as well as public ones like <code>go.uber.org/zap</code>). I've named my module <code>github.internal.com/team_name/project_name</code> I've vendored up my dependencies. So, my project structure looks like:</p>
  
  <pre><code>project
  - main.go
  - internal
    - utils.go
  - go.mod (github.internal.com/team_name/project_name)
  - vendor
    - go.uber.org
    - private.repo.com
  Dockerfile
  </code></pre>
  
  <p>Then, in <code>main.go</code> I import</p>
  
  <pre><code>import (
      "github.internal.com/team_name/project_name/internal"
      "go.uber.org/zap"
  )
  </code></pre>
  
  <p>All of this works great and I can run <code>go build</code> no problem.</p>
  
  <p>The issue comes when I try to build using Docker. In my Dockerfile I run</p>
  
  <pre><code>ENV GOPATH /go
  COPY . /go/src/github.internal.com/team_name/project_name
  WORKDIR /go/src/github.internal.com/team_name/project_name
  RUN CGO_ENABLED=0 GOOS=linux go build -a -o slaxtract main.go
  </code></pre>
  
  <p>When I run <code>docker build</code> it returns:</p>
  
  <pre><code>main.go:7:2: cannot find package "github.internal.com/team_name/project_name/internal" in any of:
      /go/src/github.internal.com/project_name/team_name/vendor/github.internal.com/project_name/team_name/internal (vendor tree) 
      /usr/local/go/src/github.internal.com/team_name/project_name/internal (from $GOROOT)
      /go/src/github.internal.com/team_name/project_name/internal (from $GOPATH)
  </code></pre>
  
  <p>How do I get to the right directory to recognize all of my files in my module?</p>
  
  <p>Thanks in advance!</p>