mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
HEXONET: Implement get-zones, fix module problem (#898)
* VULTR: Update govultr to v1.0.0 (fixes #892) (#897) * go get -u github.com/hexonet/go-sdk * Fix HEXONET providers.json entry * providers.json: json commma * providers.json: fmtjson * HEXONET: Implement get-zones. Fix tests and docs. * fixup! * Update azure test failures * Move version info into its own package * Use new version system
This commit is contained in:
36
main.go
36
main.go
@@ -5,10 +5,9 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
"runtime/debug"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/StackExchange/dnscontrol/v3/commands"
|
||||
"github.com/StackExchange/dnscontrol/v3/pkg/version"
|
||||
_ "github.com/StackExchange/dnscontrol/v3/providers/_all"
|
||||
)
|
||||
|
||||
@@ -19,36 +18,5 @@ func main() {
|
||||
if info, ok := debug.ReadBuildInfo(); !ok && info == nil {
|
||||
fmt.Fprint(os.Stderr, "Warning: dnscontrol was built without Go modules. See https://github.com/StackExchange/dnscontrol#from-source for more information on how to build dnscontrol correctly.\n\n")
|
||||
}
|
||||
os.Exit(commands.Run(versionString()))
|
||||
}
|
||||
|
||||
// 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.
|
||||
// Update the number here manually each release, so at least we have a range for go-get people.
|
||||
var (
|
||||
SHA = ""
|
||||
Version = "3.3.0"
|
||||
BuildTime = ""
|
||||
)
|
||||
|
||||
// printVersion prints the version banner.
|
||||
func versionString() string {
|
||||
var version string
|
||||
if SHA != "" {
|
||||
version = fmt.Sprintf("%s (%s)", Version, SHA)
|
||||
} else {
|
||||
version = fmt.Sprintf("%s-dev", Version) // no SHA. '0.x.y-dev' indicates it is run from source without build script.
|
||||
}
|
||||
if info, ok := debug.ReadBuildInfo(); !ok && info == nil {
|
||||
version += " (non-modules)"
|
||||
}
|
||||
if BuildTime != "" {
|
||||
i, err := strconv.ParseInt(BuildTime, 10, 64)
|
||||
if err == nil {
|
||||
tm := time.Unix(i, 0)
|
||||
version += fmt.Sprintf(" built %s", tm.Format(time.RFC822))
|
||||
}
|
||||
}
|
||||
return fmt.Sprintf("dnscontrol %s", version)
|
||||
os.Exit(commands.Run("dnscontrol " + version.VersionString()))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user