mirror of https://github.com/rocboss/paopao-ce
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
567 B
35 lines
567 B
// Copyright 2025 ROC. All rights reserved.
|
|
// Use of this source code is governed by a MIT style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package version
|
|
|
|
import (
|
|
"debug/buildinfo"
|
|
"os"
|
|
"time"
|
|
)
|
|
|
|
var (
|
|
BuildTime = time.Now()
|
|
)
|
|
|
|
func init() {
|
|
exe, err := os.Executable()
|
|
if err != nil {
|
|
return
|
|
}
|
|
info, err := buildinfo.ReadFile(exe)
|
|
if err != nil {
|
|
return
|
|
}
|
|
for _, s := range info.Settings {
|
|
if s.Key == "vcs.time" && s.Value != "" {
|
|
if t, err := time.Parse(time.RFC3339, s.Value); err == nil {
|
|
BuildTime = t
|
|
}
|
|
break
|
|
}
|
|
}
|
|
}
|