Skip to content

Commit

Permalink
cmd: Clean up build-info and upgrade output
Browse files Browse the repository at this point in the history
  • Loading branch information
mholt committed Feb 15, 2021
1 parent cc63c58 commit ed67823
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cmd/commandfuncs.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,11 @@ func cmdBuildInfo(fl Flags) (int, error) {
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.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 {
Expand Down Expand Up @@ -670,6 +673,7 @@ func cmdUpgrade(_ Flags) (int, error) {
defer destFile.Close()

l.Info("downloading binary", zap.String("source", urlStr), zap.String("destination", thisExecPath))

_, err = io.Copy(destFile, resp.Body)
if err != nil {
return fmt.Errorf("unable to download file: %v", err)
Expand All @@ -687,6 +691,8 @@ func cmdUpgrade(_ Flags) (int, error) {
return caddy.ExitCodeFailedStartup, err
}

l.Info("download successful; displaying new binary details", zap.String("location", thisExecPath))

// use the new binary to print out version and module info
fmt.Print("\nModule versions:\n\n")
cmd := exec.Command(thisExecPath, "list-modules", "--versions")
Expand Down

0 comments on commit ed67823

Please sign in to comment.