2020-05-10 21:34:55 +02:00
|
|
|
//go:generate go install github.com/golangci/golangci-lint/cmd/golangci-lint
|
|
|
|
//go:generate go install github.com/client9/misspell/cmd/misspell
|
2017-04-21 15:25:32 -03:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2017-04-21 21:58:59 -03:00
|
|
|
"fmt"
|
2017-04-21 15:25:32 -03:00
|
|
|
"os"
|
|
|
|
|
2020-04-27 21:42:44 -03:00
|
|
|
"github.com/goreleaser/goreleaser/cmd"
|
2017-04-21 15:25:32 -03:00
|
|
|
)
|
|
|
|
|
2018-11-07 22:04:49 -02:00
|
|
|
// nolint: gochecknoglobals
|
2017-04-21 15:25:32 -03:00
|
|
|
var (
|
|
|
|
version = "dev"
|
2019-05-27 23:59:33 -03:00
|
|
|
commit = ""
|
|
|
|
date = ""
|
|
|
|
builtBy = ""
|
2017-04-21 15:25:32 -03:00
|
|
|
)
|
|
|
|
|
2018-11-07 22:04:49 -02:00
|
|
|
func main() {
|
2020-04-27 21:42:44 -03:00
|
|
|
cmd.Execute(
|
|
|
|
buildVersion(version, commit, date, builtBy),
|
|
|
|
os.Exit,
|
|
|
|
os.Args[1:],
|
|
|
|
)
|
2018-02-21 20:04:22 -03:00
|
|
|
}
|
2019-05-27 23:59:33 -03:00
|
|
|
|
|
|
|
func buildVersion(version, commit, date, builtBy string) string {
|
2020-04-27 21:42:44 -03:00
|
|
|
var result = version
|
2019-05-27 23:59:33 -03:00
|
|
|
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
|
|
|
|
}
|