forked from zhzxdev/azukiiro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
47 lines (42 loc) · 897 Bytes
/
main.go
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
35
36
37
38
39
40
41
42
43
44
45
46
47
package main
import (
"context"
"fmt"
"os/signal"
"runtime/debug"
"syscall"
_ "github.com/fedstackjs/azukiiro/adapters"
"github.com/fedstackjs/azukiiro/cli"
"github.com/fedstackjs/azukiiro/common"
)
var (
version string
)
func init() {
if version != "" {
common.Version = fmt.Sprintf("azukiiro/%s", version)
if info, ok := debug.ReadBuildInfo(); ok {
version = " ("
version += info.Main.Path
for _, setting := range info.Settings {
switch setting.Key {
case "vcs.revision":
version += "; " + setting.Value[:7]
case "vcs.modified":
if setting.Value == "true" {
version += "; modified"
}
}
}
version += ")"
common.Version += version
} else {
common.Version += " (unknown)"
}
}
}
func main() {
ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
defer stop()
cli.Execute(ctx)
}