mirror of
https://github.com/caddyserver/caddy.git
synced 2025-06-14 18:26:27 +08:00
cmd: Use newly-available version information (#4931)
This commit is contained in:
@ -331,30 +331,17 @@ func cmdReload(fl Flags) (int, error) {
|
||||
}
|
||||
|
||||
func cmdVersion(_ Flags) (int, error) {
|
||||
fmt.Println(CaddyVersion())
|
||||
_, full := caddy.Version()
|
||||
fmt.Println(full)
|
||||
return caddy.ExitCodeSuccess, nil
|
||||
}
|
||||
|
||||
func cmdBuildInfo(fl Flags) (int, error) {
|
||||
func cmdBuildInfo(_ Flags) (int, error) {
|
||||
bi, ok := debug.ReadBuildInfo()
|
||||
if !ok {
|
||||
return caddy.ExitCodeFailedStartup, fmt.Errorf("no build information")
|
||||
}
|
||||
|
||||
fmt.Printf("go_version: %s\n", runtime.Version())
|
||||
fmt.Printf("go_os: %s\n", runtime.GOOS)
|
||||
fmt.Printf("go_arch: %s\n", runtime.GOARCH)
|
||||
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()
|
||||
}
|
||||
fmt.Println(bi)
|
||||
return caddy.ExitCodeSuccess, nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user