File tree Expand file tree Collapse file tree 4 files changed +14
-23
lines changed
Expand file tree Collapse file tree 4 files changed +14
-23
lines changed Original file line number Diff line number Diff line change 2424 uses : actions/checkout@v4
2525 with :
2626 fetch-depth : 0
27- -
28- name : Find Git Tag
29- id : tagger
30- uses : jimschubert/query-tag-action@v2
31- with :
32- include : ' v*'
33- exclude : ' *-rc*'
34- commit-ish : ' HEAD'
35- skip-unshallow : ' true'
36- abbrev : 7
3727 -
3828 name : Set up QEMU
3929 uses : docker/setup-qemu-action@v3
7262 push : true
7363 tags : ${{ steps.scratch_meta.outputs.tags }}
7464 labels : ${{ steps.scratch_meta.outputs.labels }}
75- build-args : ' GIT_DESC=${{steps.tagger.outputs.tag}}'
7665 -
7766 name : Docker alpine meta
7867 id : alpine_meta
10089 push : true
10190 tags : ${{ steps.alpine_meta.outputs.tags }}
10291 labels : ${{ steps.alpine_meta.outputs.labels }}
103- build-args : ' GIT_DESC=${{steps.tagger.outputs.tag}}'
Original file line number Diff line number Diff line change 11FROM --platform=$BUILDPLATFORM golang AS build
22
3- ARG GIT_DESC=undefined
4-
53WORKDIR /go/src/github.com/SenseUnit/dumbproxy
64COPY . .
75ARG TARGETOS TARGETARCH
8- RUN GOOS=$TARGETOS GOARCH=$TARGETARCH CGO_ENABLED=0 go build -a -tags netgo -ldflags '-s -w -extldflags "-static" -X main.version=' "$GIT_DESC"
6+ RUN GOOS=$TARGETOS GOARCH=$TARGETARCH CGO_ENABLED=0 go build -a -tags netgo -ldflags '-s -w -extldflags "-static"'
97RUN mkdir /.dumbproxy
108
119FROM scratch AS scratch
Original file line number Diff line number Diff line change 11PROGNAME = dumbproxy
22OUTSUFFIX = bin/$(PROGNAME )
3- VERSION := $(shell git describe)
43BUILDOPTS = -a -tags netgo -trimpath -asmflags -trimpath
5- LDFLAGS = -ldflags '-s -w -extldflags "-static" -X main.version= $( VERSION ) '
6- LDFLAGS_NATIVE = -ldflags '-s -w -X main.version= $( VERSION ) '
4+ LDFLAGS = -ldflags '-s -w -extldflags "-static"'
5+ LDFLAGS_NATIVE = -ldflags '-s -w'
76
87NDK_CC_ARM = $(abspath ../../ndk-toolchain-arm/bin/arm-linux-androideabi-gcc)
98NDK_CC_ARM64 = $(abspath ../../ndk-toolchain-arm64/bin/aarch64-linux-android21-clang)
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import (
2323 "os/signal"
2424 "path/filepath"
2525 "runtime"
26+ "runtime/debug"
2627 "strconv"
2728 "strings"
2829 "syscall"
@@ -50,10 +51,7 @@ import (
5051 _ "golang.org/x/crypto/x509roots/fallback"
5152)
5253
53- var (
54- home , _ = os .UserHomeDir ()
55- version = "undefined"
56- )
54+ var home , _ = os .UserHomeDir ()
5755
5856func perror (msg string ) {
5957 fmt .Fprintln (os .Stderr , "" )
@@ -480,7 +478,7 @@ func run() int {
480478
481479 // handle special invocation modes
482480 if args .showVersion {
483- fmt .Println (version )
481+ fmt .Println (version () )
484482 return 0
485483 }
486484
@@ -1109,6 +1107,14 @@ func readConfig(filename string) error {
11091107 return nil
11101108}
11111109
1110+ func version () string {
1111+ bi , ok := debug .ReadBuildInfo ()
1112+ if ! ok {
1113+ return "unknown"
1114+ }
1115+ return bi .Main .Version
1116+ }
1117+
11121118func main () {
11131119 os .Exit (run ())
11141120}
You can’t perform that action at this time.
0 commit comments