diff options
author | Matthew Holt <mholt@users.noreply.github.com> | 2020-01-10 11:53:07 -0700 |
---|---|---|
committer | Matthew Holt <mholt@users.noreply.github.com> | 2020-01-10 11:53:07 -0700 |
commit | ba514f9660519c0ddee3eefdbe9c9ed4a3ba5c7f (patch) | |
tree | 0b700f94e738011cf071e6a17e7b6097f6ce10b1 /cmd | |
parent | 3dcc34d3418d3ef5835eac512a52226e47727cfb (diff) |
cmd: Add build-info command; update CertMagic
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/commandfuncs.go | 20 | ||||
-rw-r--r-- | cmd/commands.go | 6 |
2 files changed, 26 insertions, 0 deletions
diff --git a/cmd/commandfuncs.go b/cmd/commandfuncs.go index 7d88e00..422b63a 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 93ebeff..87ded60 100644 --- a/cmd/commands.go +++ b/cmd/commands.go @@ -189,6 +189,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, Short: "Prints the environment", |