[VOL-1920] Migrated voltha-go from dep to go mod for dependency management

Change-Id: Ie14418cef7ba046a7c43a343b9017c436af6b395
diff --git a/docker/Dockerfile.rw_core b/docker/Dockerfile.rw_core
index 3daab28..523d447 100644
--- a/docker/Dockerfile.rw_core
+++ b/docker/Dockerfile.rw_core
@@ -26,13 +26,13 @@
 	protobuf=3.6.1-r1 \
 	protobuf-dev=3.6.1-r1
 
-# Prepare directory structure
-RUN mkdir -p /build \
-	"$GOPATH/src/" "$GOPATH/pkg" "$GOPATH/bin" \
-	"$GOPATH/src/github.com/opencord" \
-	"$GOPATH/src/github.com/opencord/voltha-go"
+# Golang container has GOPATH set to /go by default. Hence, need to explicitly enable
+# Go modules while using folder /go/src under GOPATH as build path; lest go modules
+# will be disabled
+ENV GO111MODULE=on
 
-WORKDIR $GOPATH/src/github.com/opencord/voltha-go
+# Use Standard go build directory structure
+WORKDIR /go/src
 
 # Copy common files.
 COPY common ./common
@@ -42,6 +42,8 @@
 
 # Copy files
 COPY rw_core ./rw_core
+COPY go.mod ./
+COPY go.sum ./
 
 ARG org_label_schema_version=unknown
 ARG org_label_schema_vcs_url=unknown
@@ -51,9 +53,9 @@
 ARG org_opencord_vcs_dirty=unknown
 
 # Build
-WORKDIR $GOPATH/src/github.com/opencord/voltha-go/rw_core
+WORKDIR /go/src/rw_core
 SHELL ["/bin/ash", "-o", "pipefail", "-c"]
-RUN go build -o /build/rw_core \
+RUN go build -mod=vendor -o /go/bin/rw_core \
 	-ldflags \
 	"-X github.com/opencord/voltha-go/common/version.version=$org_label_schema_version \
 	 -X github.com/opencord/voltha-go/common/version.vcsRef=$org_label_schema_vcs_ref  \
@@ -72,7 +74,7 @@
 WORKDIR /app
 
 # Copy required files
-COPY --from=build-env /build/rw_core /app/
+COPY --from=build-env /go/bin/rw_core /app/
 
 # Label image
 ARG org_label_schema_version=unknown