File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 9999 - name : Go mod tidy
100100 run : go mod tidy
101101
102+ - name : Setup build tags for Alpine
103+ if : matrix.container != null
104+ run : |
105+ echo "GO_BUILD_TAGS=netgo static osusergo" >> $GITHUB_ENV
106+ echo "GO_LDFLAGS=-linkmode external -extldflags '-static'" >> $GITHUB_ENV
107+
102108 - name : Go code test (CGO_ENABLED=${{ matrix.cgo_enabled }})
103109 run : |
104- CGO_ENABLED=${{ matrix.cgo_enabled }} go test ./... -v
110+ if [ -n "${{ matrix.container }}" ]; then
111+ BUILD_TAGS="$GO_BUILD_TAGS"
112+ EXTRA_LDFLAGS="$GO_LDFLAGS"
113+ fi
114+
115+ CGO_ENABLED=${{ matrix.cgo_enabled }} \
116+ go test ./... -v \
117+ -tags="${BUILD_TAGS}" \
118+ -ldflags="${EXTRA_LDFLAGS}"
105119 env :
106120 CGO_LDFLAGS : ${{ matrix.cgo_enabled == '1' && '-static' || '' }}
You can’t perform that action at this time.
0 commit comments