1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-04 03:11:55 +02:00
goreleaser/main.go

39 lines
625 B
Go
Raw Normal View History

2017-04-21 20:25:32 +02:00
package main
import (
2017-04-22 02:58:59 +02:00
"fmt"
2017-04-21 20:25:32 +02:00
"os"
"github.com/goreleaser/goreleaser/cmd"
2017-04-21 20:25:32 +02:00
)
2018-11-08 02:04:49 +02:00
// nolint: gochecknoglobals
2017-04-21 20:25:32 +02:00
var (
version = "dev"
commit = ""
date = ""
builtBy = ""
2017-04-21 20:25:32 +02:00
)
2018-11-08 02:04:49 +02:00
func main() {
cmd.Execute(
buildVersion(version, commit, date, builtBy),
os.Exit,
os.Args[1:],
)
}
func buildVersion(version, commit, date, builtBy string) string {
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
}