-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
41 lines (37 loc) · 753 Bytes
/
Copy pathmain.go
File metadata and controls
41 lines (37 loc) · 753 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
35
36
37
38
39
40
41
//go:generate go run github.com/99designs/gqlgen generate --verbose
package main
import (
"fmt"
"os"
"runtime/debug"
"time"
"github.com/obcode/plexams.go/cmd"
"github.com/spf13/viper"
)
var (
version = "dev"
commit = "none"
date = "unknown"
builtBy = "unknown"
)
func main() {
loc, _ := time.LoadLocation("Europe/Berlin")
time.Local = loc
if version == "dev" {
if info, ok := debug.ReadBuildInfo(); ok && info.Main.Version != "" {
version = info.Main.Version
}
}
viper.Set("Version", version)
viper.Set("Commit", commit)
viper.Set("Date", date)
viper.Set("BuiltBy", builtBy)
err := cmd.Execute()
if err != nil {
_, err := fmt.Fprintln(os.Stderr, "Error:", err)
if err != nil {
panic(err)
}
os.Exit(-1)
}
}