Skip to content

Commit 4e6754b

Browse files
committed
removing buildmode=pie for arm build (ref golang/go#50405)
1 parent 3a42e36 commit 4e6754b

File tree

1 file changed

+29
-14
lines changed

1 file changed

+29
-14
lines changed

.github/workflows/release.yml

+29-14
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
matrix:
1818
target:
1919
- "linux:arm64:"
20-
# - "linux:arm:"
20+
- "linux:arm:"
2121
- "linux:amd64:"
2222
- "darwin:arm64:"
2323
- "darwin:amd64:"
@@ -69,19 +69,34 @@ jobs:
6969
export GOARCH="$(echo ${{ matrix.target }} | cut -d':' -f2)"
7070
export EXT="$(echo ${{ matrix.target }} | cut -d':' -f3)"
7171
72-
go build \
73-
-trimpath \
74-
-buildmode=pie \
75-
-mod=readonly \
76-
-modcacherw \
77-
-o ${{ secrets.APP_NAME }}.${GOOS}.${GOARCH} \
78-
-ldflags "\
79-
-X ${{ github.repository }}/version.APPNAME=${{ secrets.APP_NAME }} \
80-
-X ${{ github.repository }}/version.VERSION=${{ steps.prep.outputs.version }} \
81-
-X ${{ github.repository }}/version.GOVERSION=${{ steps.prep.outputs.go-version }} \
82-
-X ${{ github.repository }}/version.BUILDTIME=${{ steps.prep.outputs.buildtime }} \
83-
-X ${{ github.repository }}/version.COMMITHASH=${{ github.sha }} \
84-
-s -w"
72+
if [ $GOARCH = arm ]; then
73+
go build \
74+
-trimpath \
75+
-mod=readonly \
76+
-modcacherw \
77+
-o ${{ secrets.APP_NAME }}.${GOOS}.${GOARCH} \
78+
-ldflags "\
79+
-X ${{ github.repository }}/version.APPNAME=${{ secrets.APP_NAME }} \
80+
-X ${{ github.repository }}/version.VERSION=${{ steps.prep.outputs.version }} \
81+
-X ${{ github.repository }}/version.GOVERSION=${{ steps.prep.outputs.go-version }} \
82+
-X ${{ github.repository }}/version.BUILDTIME=${{ steps.prep.outputs.buildtime }} \
83+
-X ${{ github.repository }}/version.COMMITHASH=${{ github.sha }} \
84+
-s -w"
85+
else
86+
go build \
87+
-trimpath \
88+
-buildmode=pie \
89+
-mod=readonly \
90+
-modcacherw \
91+
-o ${{ secrets.APP_NAME }}.${GOOS}.${GOARCH} \
92+
-ldflags "\
93+
-X ${{ github.repository }}/version.APPNAME=${{ secrets.APP_NAME }} \
94+
-X ${{ github.repository }}/version.VERSION=${{ steps.prep.outputs.version }} \
95+
-X ${{ github.repository }}/version.GOVERSION=${{ steps.prep.outputs.go-version }} \
96+
-X ${{ github.repository }}/version.BUILDTIME=${{ steps.prep.outputs.buildtime }} \
97+
-X ${{ github.repository }}/version.COMMITHASH=${{ github.sha }} \
98+
-s -w"
99+
fi
85100
86101
if [ ! -z "${EXT}" ]; then
87102
mv ${{ secrets.APP_NAME }}.${GOOS}.${GOARCH} ${{ secrets.APP_NAME }}${EXT}

0 commit comments

Comments
 (0)