feat(Go_Updater): 添加全新 Go 语言实现的自动更新器
- 新增多个源文件和目录,包括 app.rc、assets、build 脚本等 - 实现了与 MirrorChyan API 交互的客户端逻辑 - 添加了版本检查、更新检测和下载 URL 生成等功能 - 嵌入了配置模板和资源文件系统 - 提供了完整的构建和发布流程
This commit is contained in:
41
Go_Updater/version/version.go
Normal file
41
Go_Updater/version/version.go
Normal file
@@ -0,0 +1,41 @@
|
||||
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,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user