mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-11-10 17:26:10 +08:00
2f83aa9302
* Switched to v2 go.mod Also set GO111MODULE=on in build stuff to always use Go modules even when in GOPATH. * Ensure go.mod, go.sum, and vendor are up to date * Attempt to fix Azure pipelines * Add set -e to properly fail on exit (it didn't seem to be propagating properly before). * Set workingDirectory for GoFmt and GoGen (this might be why it fails unlike compile and unitests). * Another attempt to fix Azure Pipelines * Use the Go env template for all go-related jobs. * Completely fixed Azure Pipelines * Added a display name to GoFmt for consistency. * Fixed diffs for GoFmt and GoGen. * Show git status for checks. * Drop GOPATH for tests TODO: Do the same for integration tests. * Drop GOPATH for integration tests * Show more diffs * Regenerate provider support matrix This wasn't done in #590...
47 lines
1.2 KiB
Go
47 lines
1.2 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"os"
|
|
"strconv"
|
|
"time"
|
|
|
|
"github.com/StackExchange/dnscontrol/v2/commands"
|
|
_ "github.com/StackExchange/dnscontrol/v2/providers/_all"
|
|
)
|
|
|
|
//go:generate go run build/generate/generate.go build/generate/featureMatrix.go
|
|
|
|
func main() {
|
|
log.SetFlags(log.LstdFlags | log.Lshortfile)
|
|
os.Exit(commands.Run(versionString()))
|
|
}
|
|
|
|
// Version management. 2 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 = "2.10.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 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)
|
|
}
|