diff options
author | Ryan <me@hackerc.at> | 2022-05-17 21:02:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-17 21:02:15 +0200 |
commit | dfdafd9e852e64d849f47370a3514cdc8f5fff10 (patch) | |
tree | 681462a1ac978654ad5551b4202683e2e50b4b35 | |
parent | build(deps): bump golangci/golangci-lint-action from 3.1.0 to 3.2.0 (#1169) (diff) | |
download | forgejo-act-dfdafd9e852e64d849f47370a3514cdc8f5fff10.tar.xz forgejo-act-dfdafd9e852e64d849f47370a3514cdc8f5fff10.zip |
feat/bug-report-extended (#1163)
* fix: connect to docker **after** checking configs
* feat: add vcs build info
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
-rw-r--r-- | cmd/root.go | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/cmd/root.go b/cmd/root.go index 568c00a..a9b88d4 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -8,6 +8,7 @@ import ( "path/filepath" "regexp" "runtime" + "runtime/debug" "strings" "github.com/AlecAivazis/survey/v2" @@ -154,12 +155,6 @@ func bugReport(ctx context.Context, version string) error { } } - info, err := container.GetHostInfo(ctx) - if err != nil { - fmt.Println(report) - return err - } - report += sprintf("Config files:", "") for _, c := range configLocations() { args := readArgsFile(c, false) @@ -171,6 +166,28 @@ func bugReport(ctx context.Context, version string) error { } } + vcs, ok := debug.ReadBuildInfo() + if ok && vcs != nil { + report += fmt.Sprintln("Build info:") + vcs := *vcs + report += sprintf("\tGo version:", vcs.GoVersion) + report += sprintf("\tModule path:", vcs.Path) + report += sprintf("\tMain version:", vcs.Main.Version) + report += sprintf("\tMain path:", vcs.Main.Path) + report += sprintf("\tMain checksum:", vcs.Main.Sum) + + report += fmt.Sprintln("\tBuild settings:") + for _, set := range vcs.Settings { + report += sprintf(fmt.Sprintf("\t\t%s:", set.Key), set.Value) + } + } + + info, err := container.GetHostInfo(ctx) + if err != nil { + fmt.Println(report) + return err + } + report += fmt.Sprintln("Docker Engine:") report += sprintf("\tEngine version:", info.ServerVersion) |