title: Build fails when importing external package with Golang and Docker
body: <p>I can't build this simple example of confluent kafka using Docker. Probably a trick with go path or an special build parameter, can't find out, tried all the default folders from go, no success.</p>
  
  <p><strong>Dockerfile</strong></p>
  
  <pre><code>FROM golang:alpine AS builder
  
  # Set necessary environmet variables needed for our image
  ENV GO111MODULE=on \
      CGO_ENABLED=0 \
      GOOS=linux \
      GOARCH=amd64
  
  ADD . /go/app
  
  # Install librdkafka
  RUN apk add librdkafka-dev pkgconf
  
  # Move to working directory /build
  WORKDIR /go/app
  
  # Copy and download dependency using go mod
  COPY go.mod .
  RUN go mod download
  
  # Copy the code into the container
  COPY . .
  
  # Build the application
  RUN go build -o main .
  
  # Run test
  RUN go test ./... -v
  
  # Move to /dist directory as the place for resulting binary folder
  WORKDIR /dist
  
  # Copy binary from build to main folder
  RUN cp /go/app/main .
  
  ############################
  # STEP 2 build a small image
  ############################
  FROM scratch
  
  COPY --from=builder /dist/main /
  
  # Command to run the executable
  ENTRYPOINT ["/main"]
  </code></pre>
  
  <p><strong>Source</strong></p>
  
  <pre><code>import (
      "fmt"
      "github.com/confluentinc/confluent-kafka-go/kafka"
      "os"
  )
  
  func main() {
  
      if len(os.Args) != 3 {
          fmt.Fprintf(os.Stderr, "Usage: %s &lt;broker&gt; &lt;topic&gt;\n",
              os.Args[0])
          os.Exit(1)
      }
  
      broker := os.Args[1]
      topic := os.Args[2]
  
      p, err := kafka.NewProducer(&amp;kafka.ConfigMap{"bootstrap.servers": broker})
  
      if err != nil {
          fmt.Printf("Failed to create producer: %s\n", err)
          os.Exit(1)
      }
  
      fmt.Printf("Created Producer %v\n", p)
  
      deliveryChan := make(chan kafka.Event)
  
      value := "Hello Go!"
      err = p.Produce(&amp;kafka.Message{
          TopicPartition: kafka.TopicPartition{Topic: &amp;topic, Partition: kafka.PartitionAny},
          Value:          []byte(value),
          Headers:        []kafka.Header{{Key: "myTestHeader", Value: []byte("header values are binary")}},
      }, deliveryChan)
  
      e := &lt;-deliveryChan
      m := e.(*kafka.Message)
  
      if m.TopicPartition.Error != nil {
          fmt.Printf("Delivery failed: %v\n", m.TopicPartition.Error)
      } else {
          fmt.Printf("Delivered message to topic %s [%d] at offset %v\n",
              *m.TopicPartition.Topic, m.TopicPartition.Partition, m.TopicPartition.Offset)
      }
  
      close(deliveryChan)
  }
  </code></pre>
  
  <p><strong>Error</strong></p>
  
  <pre><code>./producer_example.go:37:12: undefined: kafka.NewProducer
  ./producer_example.go:37:31: undefined: kafka.ConfigMap
  ./producer_example.go:48:28: undefined: kafka.Event
  ./producer_example.go:51:19: undefined: kafka.Message
  </code></pre>