Skip to content

Commit

Permalink
Fix issue with Go and modules
Browse files Browse the repository at this point in the history
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) <alexellis2@gmail.com>
  • Loading branch information
alexellis committed Apr 23, 2020
1 parent 93eda72 commit 382aa66
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion 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
Expand All @@ -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

Expand Down

0 comments on commit 382aa66

Please sign in to comment.