Skip to content

Commit 515e59a

Browse files
bmcustodioalexellis
authored andcommitted
Add opt-in support for using Go modules.
Signed-off-by: Bruno Miguel Custódio <brunomcustodio@gmail.com>
1 parent d751162 commit 515e59a

File tree

19 files changed

+116
-77
lines changed

19 files changed

+116
-77
lines changed

template/golang-http-armhf/Dockerfile

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
11
FROM openfaas/of-watchdog:0.7.2 as watchdog
22

3-
FROM golang:1.11-alpine3.10 as build
43

5-
ENV CGO_ENABLED=0
4+
FROM golang:1.13.1-alpine3.10 as build
5+
6+
RUN apk --no-cache add git
67

78
COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog
89
RUN chmod +x /usr/bin/fwatchdog
910

11+
ENV CGO_ENABLED=0
12+
1013
RUN mkdir -p /go/src/handler
1114
WORKDIR /go/src/handler
1215
COPY . .
1316

1417
# Run a gofmt and exclude all vendored code.
1518
RUN test -z "$(gofmt -l $(find . -type f -name '*.go' -not -path "./vendor/*" -not -path "./function/vendor/*"))" || { echo "Run \"gofmt -s -w\" on your Golang code"; exit 1; }
1619

17-
RUN CGO_ENABLED=0 GOOS=linux \
18-
go build --ldflags "-s -w" -a -installsuffix cgo -o handler . && \
19-
go test $(go list ./... | grep -v /vendor/) -cover
20+
ARG GO111MODULE="off"
21+
ARG GOPROXY=""
22+
23+
RUN go build --ldflags "-s -w" -a -installsuffix cgo -o handler .
24+
RUN go test handler/function/... -cover
2025

2126
FROM alpine:3.10
2227
# Add non root user and certs

template/golang-http-armhf/Gopkg.lock

Lines changed: 0 additions & 15 deletions
This file was deleted.

template/golang-http-armhf/go.mod

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module handler
2+
3+
go 1.12
4+
5+
replace handler/function => ./function
6+
7+
require github.com/openfaas-incubator/go-function-sdk v0.0.0-20181217173454-cac4b8744921

template/golang-http-armhf/go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github.com/openfaas-incubator/go-function-sdk v0.0.0-20181217173454-cac4b8744921 h1:IGP0tlTdv6r/zy3Kw61EhiXao61krCUs5KRHWSzCdxM=
2+
github.com/openfaas-incubator/go-function-sdk v0.0.0-20181217173454-cac4b8744921/go.mod h1:F37Kp+hwdHP+o3UKjkGzikQg4weKiMvcegT9vCQjvjE=

template/golang-http-armhf/vendor/github.com/openfaas-incubator/go-function-sdk/LICENSE

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

template/golang-http-armhf/vendor/github.com/openfaas-incubator/go-function-sdk/README.md

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# github.com/openfaas-incubator/go-function-sdk v0.0.0-20181217173454-cac4b8744921
2+
github.com/openfaas-incubator/go-function-sdk

template/golang-http/Dockerfile

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,28 @@
11
FROM openfaas/of-watchdog:0.7.2 as watchdog
22

3-
FROM golang:1.10.4-alpine3.8 as build
3+
FROM golang:1.13.1-alpine3.10 as build
4+
5+
RUN apk --no-cache add git
46

57
ENV CGO_ENABLED=0
68

79
COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog
810
RUN chmod +x /usr/bin/fwatchdog
911

12+
ENV CGO_ENABLED=0
13+
1014
RUN mkdir -p /go/src/handler
1115
WORKDIR /go/src/handler
1216
COPY . .
1317

1418
# Run a gofmt and exclude all vendored code.
1519
RUN test -z "$(gofmt -l $(find . -type f -name '*.go' -not -path "./vendor/*" -not -path "./function/vendor/*"))" || { echo "Run \"gofmt -s -w\" on your Golang code"; exit 1; }
1620

17-
RUN CGO_ENABLED=0 GOOS=linux \
18-
go build --ldflags "-s -w" -a -installsuffix cgo -o handler . && \
19-
go test $(go list ./... | grep -v /vendor/) -cover
21+
ARG GO111MODULE="off"
22+
ARG GOPROXY=""
23+
24+
RUN go build --ldflags "-s -w" -a -installsuffix cgo -o handler .
25+
RUN go test handler/function/... -cover
2026

2127
FROM alpine:3.10
2228
# Add non root user and certs

template/golang-http/Gopkg.lock

Lines changed: 0 additions & 15 deletions
This file was deleted.

template/golang-http/Gopkg.toml

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)