File tree Expand file tree Collapse file tree 2 files changed +11
-18
lines changed
Expand file tree Collapse file tree 2 files changed +11
-18
lines changed Original file line number Diff line number Diff line change 1616 steps :
1717 - name : Checkout
1818 uses : actions/checkout@v4
19- - name : Fetch tags
20- run : git fetch --tags origin
2119
2220 - name : Setup Go
2321 uses : actions/setup-go@v5
@@ -120,8 +118,6 @@ jobs:
120118 steps :
121119 - name : Checkout
122120 uses : actions/checkout@v4
123- - name : Fetch tags
124- run : git fetch --tags origin
125121
126122 - name : Docker meta
127123 id : meta
@@ -179,8 +175,6 @@ jobs:
179175 steps :
180176 - name : Checkout
181177 uses : actions/checkout@v4
182- - name : Fetch tags
183- run : git fetch --tags origin
184178
185179 - name : Docker meta
186180 id : meta-hw
@@ -236,8 +230,6 @@ jobs:
236230 steps :
237231 - name : Checkout
238232 uses : actions/checkout@v4
239- - name : Fetch tags
240- run : git fetch --tags origin
241233
242234 - name : Docker meta
243235 id : meta-rk
Original file line number Diff line number Diff line change 77 "os/exec"
88 "runtime"
99 "runtime/debug"
10- "strings"
1110)
1211
1312var (
@@ -92,14 +91,6 @@ func Init() {
9291
9392func readRevisionTime () (revision , vcsTime string ) {
9493 if info , ok := debug .ReadBuildInfo (); ok {
95- // Rewrite version from -buildvcs info if it is valid.
96- // Format for tagged version: v1.9.13
97- // Format for custom commit: v1.9.14-0.20251215184105-753d6617ab58
98- // Format for modified code: v1.9.14-0.20251215184105-753d6617ab58+dirty
99- if s , ok := strings .CutPrefix (info .Main .Version , "v" ); ok {
100- Version = s
101- }
102-
10394 for _ , setting := range info .Settings {
10495 switch setting .Key {
10596 case "vcs.revision" :
@@ -112,10 +103,20 @@ func readRevisionTime() (revision, vcsTime string) {
112103 vcsTime = setting .Value
113104 case "vcs.modified" :
114105 if setting .Value == "true" {
115- revision += "+ dirty"
106+ revision += ". dirty"
116107 }
117108 }
118109 }
110+
111+ // Check version from -buildvcs info
112+ // Format for tagged version : v1.9.13
113+ // Format for modified code: v1.9.14-0.20251215184105-753d6617ab58+dirty
114+ if info .Main .Version != "v" + Version {
115+ // Format: 1.9.13+dev.753d661[.dirty]
116+ // Compatible with "awesomeversion" and "packaging.version" from python.
117+ // Version will be larger than the previous release, but smaller than the next release.
118+ Version += "+dev." + revision
119+ }
119120 }
120121 return
121122}
You can’t perform that action at this time.
0 commit comments