-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathmain.go
43 lines (33 loc) · 855 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
package main
import (
"fmt"
"github.com/src-d/sourced-ce/cmd/sourced/cmd"
composefile "github.com/src-d/sourced-ce/cmd/sourced/compose/file"
"github.com/src-d/sourced-ce/cmd/sourced/format"
"github.com/src-d/sourced-ce/cmd/sourced/release"
)
// this variable is rewritten during the CI build step
var version = "master"
var build = "dev"
func main() {
composefile.SetVersion(version)
cmd.Init(version, build)
checkUpdates()
cmd.Execute()
}
func checkUpdates() {
if version == "master" {
return
}
update, latest, err := release.FindUpdates(version)
if err != nil {
return
}
if update {
s := fmt.Sprintf(
`There is a newer version. Current version: %s, latest version: %s
Please go to https://github.com/src-d/sourced-ce/releases/latest to upgrade.
`, version, latest)
fmt.Println(format.Colorize(format.Yellow, s))
}
}