Skip to content

Commit e1b35a4

Browse files
committed
chore: read pkg name automatically
Signed-off-by: Yves Brissaud <[email protected]>
1 parent 650e9e6 commit e1b35a4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@ ENV CGO_ENABLED=0
3434
RUN --mount=type=cache,target=/root/.cache \
3535
--mount=type=cache,target=/go/pkg/mod \
3636
GIT_VERSION=$(git describe --tags | cut -c 2-) && \
37+
PKG_NAME=$(go mod graph | head -n 1 | cut -d ' ' -f 1) && \
3738
xx-go build \
3839
-o dist/${BIN_NAME} \
3940
-ldflags="-w -s \
40-
-X {{.PKG_NAME}}/internal/constants.Version=$GIT_VERSION" \
41+
-X $PKG_NAME/internal/constants.Version=$GIT_VERSION" \
4142
./cmd/${BIN_NAME} && \
4243
xx-verify dist/${BIN_NAME} && \
4344
# on windows add the .exe extension and zip the binary \

0 commit comments

Comments
 (0)