-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
34 lines (28 loc) · 930 Bytes
/
Copy pathmain.go
File metadata and controls
34 lines (28 loc) · 930 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//go:build (linux && !android) || (darwin && !ios)
// Command ormos runs the system on a personal machine.
package main
import (
"os"
"runtime/debug"
"strings"
"github.com/nicodes/ormos/internal/system"
)
// version is the build version, overridden at release time via
// -ldflags "-X main.version=...". Defaults to "dev" for local builds.
var version = "dev"
func main() { system.Main(os.Args[1:], resolvedVersion(version)) }
// resolvedVersion keeps release archives and module-aware `go run` builds
// consistent. Archives stamp version with -ldflags; `go run ...@vX.Y.Z`
// records it in the binary's Go build information.
func resolvedVersion(stamped string) string {
if stamped != "" && stamped != "dev" {
return strings.TrimPrefix(stamped, "v")
}
if info, ok := debug.ReadBuildInfo(); ok {
v := info.Main.Version
if v != "" && v != "(devel)" {
return strings.TrimPrefix(v, "v")
}
}
return "dev"
}