2016-08-22 18:31:50 -06:00
package main
import (
"fmt"
"log"
2017-09-15 09:59:43 -04:00
"os"
2020-10-10 10:34:04 -04:00
"runtime/debug"
2016-08-22 18:31:50 -06:00
2023-05-20 19:21:45 +02:00
"github.com/StackExchange/dnscontrol/v4/commands"
"github.com/StackExchange/dnscontrol/v4/pkg/version"
_ "github.com/StackExchange/dnscontrol/v4/providers/_all"
2023-02-19 16:54:53 +01:00
"github.com/fatih/color"
2016-08-22 18:31:50 -06:00
)
2023-01-12 16:59:42 -05:00
//go:generate go run build/generate/generate.go build/generate/featureMatrix.go build/generate/functionTypes.go build/generate/dtsFile.go
2016-08-22 18:31:50 -06:00
2020-10-12 12:54:40 -04:00
// 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.
var (
SHA = ""
2022-08-15 10:41:45 -04:00
Version = ""
2020-10-12 12:54:40 -04:00
BuildTime = ""
)
2016-08-22 18:31:50 -06:00
func main ( ) {
2020-10-12 12:54:40 -04:00
version . SHA = SHA
2020-10-18 14:04:50 -04:00
version . Semver = Version
2020-10-12 12:54:40 -04:00
version . BuildTime = BuildTime
2023-02-19 16:54:53 +01:00
if os . Getenv ( "CI" ) == "true" {
color . NoColor = false
}
2016-08-22 18:31:50 -06:00
log . SetFlags ( log . LstdFlags | log . Lshortfile )
2020-10-10 10:34:04 -04:00
if info , ok := debug . ReadBuildInfo ( ) ; ! ok && info == nil {
2023-01-20 13:56:20 +01:00
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" )
2020-10-10 10:34:04 -04:00
}
2020-10-18 14:04:50 -04:00
os . Exit ( commands . Run ( "dnscontrol " + version . Banner ( ) ) )
2016-08-22 18:31:50 -06:00
}