1From e46a41faac008ede4acbeb18db5b3076eb206de5 Mon Sep 17 00:00:00 2001
2From: wxt <3264117476@qq.com>
3Date: Sun, 3 Nov 2024 15:11:49 +0800
4Subject: [PATCH] Add version info
5
6---
7 main.go | 1 +
8 testdata/script/help.txtar | 2 +-
9 2 files changed, 2 insertions(+), 1 deletion(-)
10
11diff --git a/main.go b/main.go
12index 0de5a2f..1c830b1 100644
13--- a/main.go
14+++ b/main.go
15@@ -362,6 +362,7 @@ func mainErr(args []string) error {
16 // manually construct something like a pseudo-version.
17 // TODO: remove when this code is dead, hopefully in Go 1.22.
18 if mod.Version == "(devel)" {
19+ mod.Version = "@version@"
20 var vcsTime time.Time
21 var vcsRevision string
22 for _, setting := range info.Settings {
23diff --git a/testdata/script/help.txtar b/testdata/script/help.txtar
24index 8f25260..859f492 100644
25--- a/testdata/script/help.txtar
26+++ b/testdata/script/help.txtar
27@@ -91,7 +91,7 @@ stderr 'directory not found'
28 # and to be able to use static VCS info, use an environment variable.
29 # First, test without the information, and then with it.
30 exec garble version
31-stdout -count=1 'mvdan.cc/garble \(devel\)'
32+stdout -count=1 'mvdan.cc/garble @version@'
33 stdout -count=1 'Build settings'
34 stdout -count=3 '-compiler|GOOS|GOARCH'
35 ! stdout 'vcs'
36--
372.46.1
38