summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/commandfuncs.go20
-rw-r--r--cmd/commands.go6
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",