mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 19:11:25 +01:00
fix(release): lightweight tags in the snap build, version fallback, man pages for help topics, draft the 1.0.0 changelog
Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
9 files changed
+100
-12
No files matched your search
@@ -36,13 +36,29 @@ func Format() string {
|
||||
return format(Version, Tags, runtime.Version(), info)
|
||||
}
|
||||
|
||||
// Current returns the version of this build: the ldflags stamp, else the module version recorded
|
||||
// by go install, else "development".
|
||||
func Current() string {
|
||||
info, _ := debug.ReadBuildInfo()
|
||||
return resolve(Version, info)
|
||||
}
|
||||
|
||||
func resolve(version string, info *debug.BuildInfo) string {
|
||||
// A build without a checkout (a source archive) stamps an empty version.
|
||||
if version != "" && version != "development" {
|
||||
return version
|
||||
}
|
||||
// go install gitea.dev/tea@v1.0.0 stamps the module version instead of the ldflags.
|
||||
if info != nil && info.Main.Version != "" && info.Main.Version != "(devel)" {
|
||||
return strings.TrimPrefix(info.Main.Version, "v")
|
||||
}
|
||||
return "development"
|
||||
}
|
||||
|
||||
func format(version, tags, goVersion string, info *debug.BuildInfo) string {
|
||||
version = resolve(version, info)
|
||||
date := ""
|
||||
if info != nil {
|
||||
// go install gitea.dev/tea@v1.0.0 stamps the module version instead of the ldflags.
|
||||
if version == "development" && info.Main.Version != "" && info.Main.Version != "(devel)" {
|
||||
version = strings.TrimPrefix(info.Main.Version, "v")
|
||||
}
|
||||
for _, setting := range info.Settings {
|
||||
if setting.Key != "vcs.time" {
|
||||
continue
|
||||
|
||||
Reference in new issue
Block a user