title: Golang: go build failing when called as part of makefile
body: <p>I have the following make file:</p>
  
  <pre><code>default: builddocker
  
  setup:
       go get github.com/golang/protobuf/proto
       go get github.com/golang/protobuf/protoc-gen-go
       go get golang.org/x/net/context
       go get google.golang.org/grpc
  
  buildgo:
      CGO_ENABLED=0 GOOS=linux go build -ldflags "-s" -a -installsuffix cgo -o main ./customer-server/
  
  builddocker:
                      docker build -t johnwesonga/grpc/customer-server -f ./Dockerfile.build .
                      docker run -t johnwesonga/grpc/customer-server /bin/true
                      docker cp `docker ps -q -n=1`:/main .
                      chmod 755 ./main
                      docker build --rm=true --tag=johnwesonga/grpc/customer-server -f Dockerfile.static .
  </code></pre>
  
  <p>My Dockerfile.build has:</p>
  
  <pre><code>FROM golang
  
  ADD Makefile /
  WORKDIR /
  RUN make setup
  
  RUN make buildgo
  CMD ["/bin/bash"]
  </code></pre>
  
  <p>But every time I run "make builddocker" I get the following error:</p>
  
  <pre><code>CGO_ENABLED=0 GOOS=linux go build -ldflags "-s" -a -installsuffix cgo -o main ./customer-server/
  can't load package: package ./customer-server: open /customer-server: no such file or directory
  make: *** [buildgo] Error 1
  Makefile:10: recipe for target 'buildgo' failed
  The command '/bin/sh -c make buildgo' returned a non-zero code: 2
  make: *** [builddocker] Error 2
  </code></pre>
  
  <p>But if I run "Make buildgo" it works just fine, any idea why this is failing?</p>
  
  <p>FYI my source tree as follows:</p>
  
  <pre><code>/go/src/github.com/johnwesonga/grpc/MakeFile
  /go/src/github.com/johnwesonga/grpc/customer-server
  /go/src/github.com/johnwesonga/grpc/customer-server/main.go
  </code></pre>