Files
AUTO-MAS-test/Go_Updater/version/version.go
AoXuan 228e66315c feat(Go_Updater): 添加全新 Go 语言实现的自动更新器
- 新增多个源文件和目录,包括 app.rc、assets、build 脚本等
- 实现了与 MirrorChyan API 交互的客户端逻辑
- 添加了版本检查、更新检测和下载 URL 生成等功能
- 嵌入了配置模板和资源文件系统
- 提供了完整的构建和发布流程
2025-07-20 16:30:14 +08:00

41 lines
883 B
Go

package version
import (
"fmt"
"runtime"
)
var (
// Version is the current version of the application
Version = "1.0.0"
// BuildTime is set during build time
BuildTime = "unknown"
// GitCommit is set during build time
GitCommit = "unknown"
// GoVersion is the Go version used to build
GoVersion = runtime.Version()
)
// GetVersionInfo returns formatted version information
func GetVersionInfo() string {
return fmt.Sprintf("Version: %s\nBuild Time: %s\nGit Commit: %s\nGo Version: %s",
Version, BuildTime, GitCommit, GoVersion)
}
// GetShortVersion returns just the version number
func GetShortVersion() string {
return Version
}
// GetBuildInfo returns build-specific information
func GetBuildInfo() map[string]string {
return map[string]string{
"version": Version,
"build_time": BuildTime,
"git_commit": GitCommit,
"go_version": GoVersion,
}
}