github.com/joselitofilho/goreleaser@v0.155.1-0.20210123221854-e4891856c593/main.go (about) 1 //go:generate go install github.com/golangci/golangci-lint/cmd/golangci-lint 2 //go:generate go install github.com/client9/misspell/cmd/misspell 3 package main 4 5 import ( 6 "fmt" 7 "os" 8 9 "github.com/goreleaser/goreleaser/cmd" 10 ) 11 12 // nolint: gochecknoglobals 13 var ( 14 version = "dev" 15 commit = "" 16 date = "" 17 builtBy = "" 18 ) 19 20 func main() { 21 cmd.Execute( 22 buildVersion(version, commit, date, builtBy), 23 os.Exit, 24 os.Args[1:], 25 ) 26 } 27 28 func buildVersion(version, commit, date, builtBy string) string { 29 var result = version 30 if commit != "" { 31 result = fmt.Sprintf("%s\ncommit: %s", result, commit) 32 } 33 if date != "" { 34 result = fmt.Sprintf("%s\nbuilt at: %s", result, date) 35 } 36 if builtBy != "" { 37 result = fmt.Sprintf("%s\nbuilt by: %s", result, builtBy) 38 } 39 return result 40 }