diff --git a/cmd/commandfuncs.go b/cmd/commandfuncs.go index 7d88e003..422b63a4 100644 --- a/cmd/commandfuncs.go +++ b/cmd/commandfuncs.go @@ -321,6 +321,26 @@ func cmdVersion(_ Flags) (int, error) { return caddy.ExitCodeSuccess, nil } +func cmdBuildInfo(fl Flags) (int, error) { + bi, ok := debug.ReadBuildInfo() + if !ok { + return caddy.ExitCodeFailedStartup, fmt.Errorf("no build information") + } + + fmt.Printf("path: %s\n", bi.Path) + fmt.Printf("main: %s %s %s\n", bi.Main.Path, bi.Main.Version, bi.Main.Sum) + fmt.Println("dependencies:") + + for _, goMod := range bi.Deps { + fmt.Printf("%s %s %s", goMod.Path, goMod.Version, goMod.Sum) + if goMod.Replace != nil { + fmt.Printf(" => %s %s %s", goMod.Replace.Path, goMod.Replace.Version, goMod.Replace.Sum) + } + fmt.Println() + } + return caddy.ExitCodeSuccess, nil +} + func cmdListModules(fl Flags) (int, error) { versions := fl.Bool("versions") diff --git a/cmd/commands.go b/cmd/commands.go index 93ebeff5..87ded60c 100644 --- a/cmd/commands.go +++ b/cmd/commands.go @@ -188,6 +188,12 @@ config file; otherwise the default is assumed.`, }(), }) + RegisterCommand(Command{ + Name: "build-info", + Func: cmdBuildInfo, + Short: "Prints information about this build", + }) + RegisterCommand(Command{ Name: "environ", Func: cmdEnviron, diff --git a/go.mod b/go.mod index 18df415d..57eb4142 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,7 @@ require ( github.com/alecthomas/chroma v0.7.0 github.com/andybalholm/brotli v0.0.0-20190821151343-b60f0d972eeb github.com/cenkalti/backoff/v3 v3.1.1 // indirect + github.com/decker502/dnspod-go v0.2.0 // indirect github.com/dustin/go-humanize v1.0.0 github.com/go-acme/lego/v3 v3.3.0 github.com/golang/groupcache v0.0.0-20191002201903-404acd9df4cc @@ -17,7 +18,7 @@ require ( github.com/klauspost/cpuid v1.2.2 github.com/kylelemons/godebug v1.1.0 // indirect github.com/lucas-clemente/quic-go v0.14.1 - github.com/mholt/certmagic v0.9.0 + github.com/mholt/certmagic v0.9.1 github.com/miekg/dns v1.1.25 // indirect github.com/muhammadmuzzammil1998/jsonc v0.0.0-20190906142622-1265e9b150c6 github.com/naoina/go-stringutil v0.1.0 // indirect diff --git a/go.sum b/go.sum index 31612c66..2a20fa2e 100644 --- a/go.sum +++ b/go.sum @@ -230,6 +230,8 @@ github.com/mattn/go-tty v0.0.0-20180219170247-931426f7535a/go.mod h1:XPvLUNfbS4f github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mholt/certmagic v0.9.0 h1:dYh9sZPDBTcIiPhYM/Qtv3V623/zFH34FmpbrQTpMAc= github.com/mholt/certmagic v0.9.0/go.mod h1:91uJzK5K8IWtYQqTi5R2tsxV1pCde+wdGfaRaOZi6aQ= +github.com/mholt/certmagic v0.9.1 h1:wPzyouOyE+30NIQETJuhTB5ZQWz+0Hy038vaR5WWQDE= +github.com/mholt/certmagic v0.9.1/go.mod h1:nu8jbsbtwK4205EDH/ZUMTKsfYpJA1Q7MKXHfgTihNw= github.com/miekg/dns v1.1.15 h1:CSSIDtllwGLMoA6zjdKnaE6Tx6eVUxQ29LUgGetiDCI= github.com/miekg/dns v1.1.15/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/miekg/dns v1.1.25 h1:dFwPR6SfLtrSwgDcIq2bcU/gVutB4sNApq2HBdqcakg=