1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2024-12-31 01:53:50 +02:00
goreleaser/main.go

56 lines
1.2 KiB
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"
"runtime"
feat: initial proxy build support (#2129) * feat: allow to use ModulePath on templates Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * feat: initial proxy build support Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: build Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: main check Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: make it more flexible Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: small improvements Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: copy go.sum Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: root mod proxy Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: test Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: snapshots Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: lint Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: proxy main pkg Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: environment variables Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * test: added some tests to go mod proxy feature Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: improve test Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: linte Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: goreleaser.yml Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: simplify tests Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * test: test build Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: revert unwanted changes Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: allow to run when no mod.suym Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * docs: example Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: not a go module on go 1.15 Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * docs: improve docs as per comments Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
2021-03-31 02:06:25 +02:00
"runtime/debug"
2017-04-21 20:25:32 +02:00
"github.com/charmbracelet/lipgloss"
"github.com/goreleaser/goreleaser/cmd"
"github.com/muesli/termenv"
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
)
func init() {
// enable colored output on github actions et al
if os.Getenv("CI") != "" {
lipgloss.SetColorProfile(termenv.TrueColor)
}
}
2018-11-08 02:04:49 +02:00
func main() {
cmd.Execute(
buildVersion(version, commit, date, builtBy),
os.Exit,
os.Args[1:],
)
}
const website = "\n\nhttps://goreleaser.com"
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)
}
result = fmt.Sprintf("%s\ngoos: %s\ngoarch: %s", result, runtime.GOOS, runtime.GOARCH)
feat: initial proxy build support (#2129) * feat: allow to use ModulePath on templates Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * feat: initial proxy build support Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: build Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: main check Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: make it more flexible Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: small improvements Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: copy go.sum Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: root mod proxy Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: test Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: snapshots Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: lint Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: proxy main pkg Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: environment variables Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * test: added some tests to go mod proxy feature Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: improve test Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: linte Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: goreleaser.yml Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: simplify tests Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * test: test build Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: revert unwanted changes Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: allow to run when no mod.suym Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * docs: example Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: not a go module on go 1.15 Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * docs: improve docs as per comments Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
2021-03-31 02:06:25 +02:00
if info, ok := debug.ReadBuildInfo(); ok && info.Main.Sum != "" {
result = fmt.Sprintf("%s\nmodule version: %s, checksum: %s", result, info.Main.Version, info.Main.Sum)
}
return result + website
}