Skip to content

Commit 28b1f6e

Browse files
committed
update to go 1.20 and build arm64 binaries
Signed-off-by: Alex Couture-Beil <alex@mofo.ca>
1 parent 9ed2e0d commit 28b1f6e

File tree

4 files changed

+38
-32
lines changed

4 files changed

+38
-32
lines changed

Earthfile

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
FROM golang:1.13-alpine3.11
1+
VERSION 0.7
2+
FROM golang:1.20-alpine3.17
23

34
RUN apk add --update --no-cache \
45
bash \
@@ -18,38 +19,23 @@ RUN apk add --update --no-cache \
1819
shellcheck \
1920
util-linux
2021

22+
23+
2124
WORKDIR /secretshare
2225

2326
deps:
24-
RUN go get golang.org/x/tools/cmd/goimports
25-
RUN go get golang.org/x/lint/golint
27+
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.50.0
2628
COPY go.mod go.sum .
27-
RUN go mod download
28-
SAVE IMAGE
29+
RUN go mod download
2930

3031
code:
3132
FROM +deps
3233
COPY --dir cmd ./
33-
SAVE IMAGE
3434

3535
lint:
3636
FROM +code
37-
RUN output="$(ineffassign .)" ; \
38-
if [ -n "$output" ]; then \
39-
echo "$output" ; \
40-
exit 1 ; \
41-
fi
42-
RUN output="$(goimports -d $(find . -type f -name '*.go' | grep -v \.pb\.go) 2>&1)" ; \
43-
if [ -n "$output" ]; then \
44-
echo "$output" ; \
45-
exit 1 ; \
46-
fi
47-
RUN golint -set_exit_status ./...
48-
RUN output="$(go vet ./... 2>&1)" ; \
49-
if [ -n "$output" ]; then \
50-
echo "$output" ; \
51-
exit 1 ; \
52-
fi
37+
COPY ./.golangci.yaml ./
38+
RUN golangci-lint run
5339

5440
secretshare:
5541
FROM +code
@@ -67,26 +53,44 @@ secretshare:
6753
cmd/secretshare/main.go
6854
SAVE ARTIFACT build/secretshare AS LOCAL "build/$GOOS/$GOARCH/secretshare"
6955

70-
secretshare-darwin:
56+
secretshare-darwin-amd64:
7157
COPY \
7258
--build-arg GOOS=darwin \
7359
--build-arg GOARCH=amd64 \
7460
--build-arg GO_EXTRA_LDFLAGS= \
75-
+secretshare/* ./
76-
SAVE ARTIFACT ./*
61+
+secretshare/secretshare /build/secretshare
62+
SAVE ARTIFACT /build/secretshare AS LOCAL "build/darwin/amd64/secretshare"
7763

78-
secretshare-linux:
64+
secretshare-darwin-arm64:
65+
COPY \
66+
--build-arg GOOS=darwin \
67+
--build-arg GOARCH=arm64 \
68+
--build-arg GO_EXTRA_LDFLAGS= \
69+
+secretshare/secretshare /build/secretshare
70+
SAVE ARTIFACT /build/secretshare AS LOCAL "build/darwin/arm64/secretshare"
71+
72+
secretshare-linux-amd64:
7973
COPY \
8074
--build-arg GOOS=linux \
8175
--build-arg GOARCH=amd64 \
8276
--build-arg GO_EXTRA_LDFLAGS="-linkmode external -extldflags -static" \
83-
+secretshare/* ./
84-
SAVE ARTIFACT ./*
77+
+secretshare/secretshare /build/secretshare
78+
SAVE ARTIFACT /build/secretshare AS LOCAL "build/linux/amd64/secretshare"
79+
80+
secretshare-linux-arm64:
81+
COPY \
82+
--build-arg GOOS=linux \
83+
--build-arg GOARCH=arm64 \
84+
--build-arg GO_EXTRA_LDFLAGS= \
85+
+secretshare/secretshare /build/secretshare
86+
SAVE ARTIFACT /build/secretshare AS LOCAL "build/linux/arm64/secretshare"
8587

8688
secretshare-all:
87-
COPY +secretshare-linux/secretshare ./secretshare-linux-amd64
88-
COPY +secretshare-darwin/secretshare ./secretshare-darwin-amd64
89-
SAVE ARTIFACT ./*
89+
BUILD +secretshare-linux-amd64
90+
BUILD +secretshare-linux-arm64
91+
BUILD +secretshare-darwin-amd64
92+
BUILD +secretshare-darwin-arm64
93+
9094

9195
test:
9296
COPY +secretshare-linux/secretshare ./secretshare

build/darwin/amd64/secretshare

-813 KB
Binary file not shown.

build/linux/amd64/secretshare

-814 KB
Binary file not shown.

go.mod

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
module github.com/alexcb/secret-share/v2
22

3-
go 1.14
3+
go 1.20
44

55
require (
66
github.com/jessevdk/go-flags v1.5.0
77
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad
88
)
9+
10+
require golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 // indirect

0 commit comments

Comments
 (0)