Skip to content
This repository has been archived by the owner on Feb 2, 2021. It is now read-only.

Migrate to Go modules #187

Merged
merged 1 commit into from
Feb 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,4 @@ deploy:
on:
tags: true

env:
- GO111MODULE=off
env: GO111MODULE=on
8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM teamserverless/license-check:0.3.6 as license-check

# Build stage
FROM golang:1.13 as builder
ENV GO111MODULE=off
ENV GO111MODULE=on

ENV CGO_ENABLED=0

Expand All @@ -11,12 +11,14 @@ COPY --from=license-check /license-check /usr/bin/
WORKDIR /go/src/github.com/openfaas-incubator/ofc-bootstrap
COPY . .

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

RUN /usr/bin/license-check -path ./ --verbose=false "Alex Ellis" "OpenFaaS Author(s)"
RUN go test $(go list ./... | grep -v /vendor/ | grep -v /template/|grep -v /build/) -cover \
&& VERSION=$(git describe --all --exact-match `git rev-parse HEAD` | grep tags | sed 's/tags\///') \
RUN go test $(go list ./... | grep -v /vendor/ | grep -v /template/|grep -v /build/) -cover

RUN VERSION=$(git describe --all --exact-match `git rev-parse HEAD` | grep tags | sed 's/tags\///') \
&& GIT_COMMIT=$(git rev-list -1 HEAD) \
&& CGO_ENABLED=0 GOOS=linux go build --ldflags "-s -w \
-X github.com/openfaas-incubator/ofc-bootstrap/version.GitCommit=${GIT_COMMIT} \
Expand Down
41 changes: 22 additions & 19 deletions Dockerfile.redist
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM teamserverless/license-check:0.3.6 as license-check

# Build stage
FROM golang:1.13 as builder
ENV GO111MODULE=off
ENV GO111MODULE=on

ENV CGO_ENABLED=0

Expand All @@ -11,29 +11,32 @@ COPY --from=license-check /license-check /usr/bin/
WORKDIR /go/src/github.com/openfaas-incubator/ofc-bootstrap
COPY . .

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

RUN /usr/bin/license-check -path ./ --verbose=false "Alex Ellis" "OpenFaaS Author(s)" \
&& go test $(go list ./... | grep -v /vendor/ | grep -v /template/|grep -v /build/) -cover \
&& VERSION=$(git describe --all --exact-match `git rev-parse HEAD` | grep tags | sed 's/tags\///') \
&& GIT_COMMIT=$(git rev-list -1 HEAD) \
&& CGO_ENABLED=0 GOOS=linux go build --ldflags "-s -w \
-X github.com/openfaas-incubator/ofc-bootstrap/version.GitCommit=${GIT_COMMIT} \
-X github.com/openfaas-incubator/ofc-bootstrap/version.Version=${VERSION}" \
-a -installsuffix cgo -o ofc-bootstrap \
&& CGO_ENABLED=0 GOOS=darwin go build --ldflags "-s -w \
-X github.com/openfaas-incubator/ofc-bootstrap/version.GitCommit=${GIT_COMMIT} \
-X github.com/openfaas-incubator/ofc-bootstrap/version.Version=${VERSION}" \
-a -installsuffix cgo -o ofc-bootstrap-darwin \
&& CGO_ENABLED=0 GOOS=windows go build --ldflags "-s -w \
-X github.com/openfaas-incubator/ofc-bootstrap/version.GitCommit=${GIT_COMMIT} \
-X github.com/openfaas-incubator/ofc-bootstrap/version.Version=${VERSION}" \
-a -installsuffix cgo -o ofc-bootstrap.exe
RUN /usr/bin/license-check -path ./ --verbose=false "Alex Ellis" "OpenFaaS Author(s)"
RUN go test $(go list ./... | grep -v /vendor/ | grep -v /template/|grep -v /build/) -cover

RUN VERSION=$(git describe --all --exact-match `git rev-parse HEAD` | grep tags | sed 's/tags\///') \
&& GIT_COMMIT=$(git rev-list -1 HEAD) \
&& CGO_ENABLED=0 GOOS=linux go build --ldflags "-s -w \
-X github.com/openfaas-incubator/ofc-bootstrap/version.GitCommit=${GIT_COMMIT} \
-X github.com/openfaas-incubator/ofc-bootstrap/version.Version=${VERSION}" \
-a -installsuffix cgo -o ofc-bootstrap \
&& CGO_ENABLED=0 GOOS=darwin go build --ldflags "-s -w \
-X github.com/openfaas-incubator/ofc-bootstrap/version.GitCommit=${GIT_COMMIT} \
-X github.com/openfaas-incubator/ofc-bootstrap/version.Version=${VERSION}" \
-a -installsuffix cgo -o ofc-bootstrap-darwin \
&& CGO_ENABLED=0 GOOS=windows go build --ldflags "-s -w \
-X github.com/openfaas-incubator/ofc-bootstrap/version.GitCommit=${GIT_COMMIT} \
-X github.com/openfaas-incubator/ofc-bootstrap/version.Version=${VERSION}" \
-a -installsuffix cgo -o ofc-bootstrap.exe

# Release stage
FROM alpine:3.11


RUN apk --no-cache add ca-certificates git

RUN addgroup -S app \
Expand All @@ -42,12 +45,12 @@ RUN addgroup -S app \

WORKDIR /home/app

USER app

COPY --from=builder /go/src/github.com/openfaas-incubator/ofc-bootstrap/ofc-bootstrap /usr/bin/
COPY --from=builder /go/src/github.com/openfaas-incubator/ofc-bootstrap/ofc-bootstrap-darwin /usr/bin/
COPY --from=builder /go/src/github.com/openfaas-incubator/ofc-bootstrap/ofc-bootstrap.exe /usr/bin/

USER app

ENV PATH=$PATH:/usr/bin/

CMD ["ofc-bootstrap"]
104 changes: 0 additions & 104 deletions Gopkg.lock

This file was deleted.

21 changes: 0 additions & 21 deletions Gopkg.toml

This file was deleted.

3 changes: 2 additions & 1 deletion cmd/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ func runApplyCommandE(command *cobra.Command, _ []string) error {

fmt.Fprintf(os.Stdout, "Plan loaded from: %s\n", files)

os.Mkdir("tmp", 0700)
os.MkdirAll("tmp", 0700)
ioutil.WriteFile("tmp/go.mod", []byte("\n"), 0700)

fmt.Fprint(os.Stdout, "Validating registry credentials file")

Expand Down
14 changes: 14 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module github.com/openfaas-incubator/ofc-bootstrap

go 1.13

require (
github.com/alexellis/go-execute v0.0.0-20200124154445-8697e4e28c5e
github.com/alexellis/k3sup v0.0.0-20200211110243-d7d1e594bc55
github.com/imdario/mergo v0.3.8
github.com/inlets/inletsctl v0.0.0-20200211123457-caff14436308
github.com/morikuni/aec v1.0.0
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v0.0.5
gopkg.in/yaml.v2 v2.2.8
)
Loading