Reset master to testing content

This commit is contained in:
Storm Dragon committed 2026-10-25 01:57:54 -04:00
1 parent 0f2587b719
commit 42afa2a56c
1483 files changed
+145308 -938069

No files matched your search

+43
View File
@@ -0,0 +1,43 @@
// Copyright (c) 2026 Storm Dragon
// Authors: Storm Dragon, Angus Kola
// SPDX-License-Identifier: GPL-3.0-or-later
package version
import (
"runtime"
"runtime/debug"
)
// Identity describes the executable itself, without consulting a checkout that
// may have changed since it was built. Missing VCS stamps remain explicit.
type Identity struct {
GoVersion string `json:"go_version"`
Revision string `json:"vcs_revision"`
Time string `json:"vcs_time"`
Modified string `json:"vcs_modified"`
}
func RuntimeIdentity() Identity {
info, _ := debug.ReadBuildInfo()
return build_identity(info)
}
func build_identity(info *debug.BuildInfo) Identity {
identity := Identity{GoVersion: runtime.Version(), Revision: "unknown", Time: "unknown", Modified: "unknown"}
if info == nil {
return identity
}
identity.GoVersion = info.GoVersion
for _, setting := range info.Settings {
switch setting.Key {
case "vcs.revision":
identity.Revision = setting.Value
case "vcs.time":
identity.Time = setting.Value
case "vcs.modified":
identity.Modified = setting.Value
}
}
return identity
}