1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

CICD: GoReleaser version (#2737)

Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
This commit is contained in:
Jeffrey Cafferata
2024-01-02 21:14:35 +01:00
committed by GitHub
parent 8ed137aff5
commit 17da0bc69f
9 changed files with 19 additions and 94 deletions

13
main.go
View File

@ -2,12 +2,10 @@ package main
import (
"fmt"
"log"
"os"
"runtime/debug"
"github.com/StackExchange/dnscontrol/v4/commands"
"github.com/StackExchange/dnscontrol/v4/pkg/version"
_ "github.com/StackExchange/dnscontrol/v4/providers/_all"
"github.com/fatih/color"
)
@ -17,22 +15,17 @@ import (
// Version management. Goals:
// 1. Someone who just does "go get" has at least some information.
// 2. If built with build/build.go, more specific build information gets put in.
// GoReleaser: version
var (
SHA = ""
Version = ""
BuildTime = ""
version = "dev"
)
func main() {
version.SHA = SHA
version.Semver = Version
version.BuildTime = BuildTime
if os.Getenv("CI") == "true" {
color.NoColor = false
}
log.SetFlags(log.LstdFlags | log.Lshortfile)
if info, ok := debug.ReadBuildInfo(); !ok && info == nil {
fmt.Fprint(os.Stderr, "Warning: dnscontrol was built without Go modules. See https://docs.dnscontrol.org/getting-started/getting-started#source for more information on how to build dnscontrol correctly.\n\n")
}
os.Exit(commands.Run("dnscontrol " + version.Banner()))
os.Exit(commands.Run("DNSControl " + version))
}