mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2025-01-10 09:27:46 +08:00
Require Go Modules to build (#902)
* Add module info to version * Add warning if built without Go modules * Updated source installation instructions for Go modules
This commit is contained in:
parent
d27e9d3eb7
commit
bc8bcf88c4
2 changed files with 8 additions and 1 deletions
|
@ -120,7 +120,7 @@ To install, simply run
|
|||
|
||||
To download the source
|
||||
|
||||
go get -d github.com/StackExchange/dnscontrol
|
||||
git clone github.com/StackExchange/dnscontrol
|
||||
|
||||
If these don't work, more info is in [#805](https://github.com/StackExchange/dnscontrol/issues/805).
|
||||
|
||||
|
|
7
main.go
7
main.go
|
@ -4,6 +4,7 @@ import (
|
|||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"runtime/debug"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
|
@ -15,6 +16,9 @@ import (
|
|||
|
||||
func main() {
|
||||
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://github.com/StackExchange/dnscontrol#from-source for more information on how to build dnscontrol correctly.\n\n")
|
||||
}
|
||||
os.Exit(commands.Run(versionString()))
|
||||
}
|
||||
|
||||
|
@ -36,6 +40,9 @@ func versionString() string {
|
|||
} 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 {
|
||||
|
|
Loading…
Reference in a new issue