From 382aa668a4cae3697e0f6cef4d700aab25484bdb Mon Sep 17 00:00:00 2001 From: "Alex Ellis (OpenFaaS Ltd)" Date: Thu, 23 Apr 2020 16:37:53 +0100 Subject: [PATCH] Fix issue with Go and modules Git is required in order to download packages. This could be installed "optionally" through checking the GO111MODULE variable for instance. Tested whilst writing docs: https://docs.openfaas.com/cli/templates/#go-go-dependencies Signed-off-by: Alex Ellis (OpenFaaS Ltd) --- template/go/Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/template/go/Dockerfile b/template/go/Dockerfile index a3cb37f4..2dd1094e 100644 --- a/template/go/Dockerfile +++ b/template/go/Dockerfile @@ -1,6 +1,9 @@ FROM openfaas/classic-watchdog:0.18.1 as watchdog FROM golang:1.13-alpine3.11 as builder +# Required to enable Go modules +RUN apk add --no-cache git + # Allows you to add additional packages via build-arg ARG ADDITIONAL_PACKAGE ARG CGO_ENABLED=0 @@ -24,7 +27,7 @@ RUN test -z "$(gofmt -l $(find . -type f -name '*.go' -not -path "./vendor/*" -n WORKDIR /go/src/handler/function -RUN go test ./... -cover +RUN CGO_ENABLED=${CGO_ENABLED} go test ./... -cover WORKDIR /go/src/handler