forked from marcosnils/bin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
40 lines (35 loc) · 764 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
//go:generate go install github.com/golangci/golangci-lint/cmd/golangci-lint
//go:generate go install github.com/client9/misspell/cmd/misspell
package main
import (
"fmt"
"os"
"github.com/marcosnils/bin/cmd"
)
// nolint: gochecknoglobals
var (
version = "dev"
commit = ""
date = ""
builtBy = ""
)
func main() {
cmd.Execute(
buildVersion(version, commit, date, builtBy),
os.Exit,
os.Args[1:],
)
}
func buildVersion(version, commit, date, builtBy string) string {
var result = version
if commit != "" {
result = fmt.Sprintf("%s\ncommit: %s", result, commit)
}
if date != "" {
result = fmt.Sprintf("%s\nbuilt at: %s", result, date)
}
if builtBy != "" {
result = fmt.Sprintf("%s\nbuilt by: %s", result, builtBy)
}
return result
}