File tree 2 files changed +21
-2
lines changed
2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import (
11
11
"os"
12
12
"path/filepath"
13
13
"runtime"
14
+ "runtime/debug"
14
15
"sort"
15
16
"strings"
16
17
"sync"
@@ -20,6 +21,10 @@ import (
20
21
// A Report is the report about this reproduction attempt.
21
22
// It also holds unexported state for use during the attempt.
22
23
type Report struct {
24
+ Version string // module@version of gorebuild command
25
+ GoVersion string // version of go command gorebuild was built with
26
+ GOOS string
27
+ GOARCH string
23
28
Start time.Time // time reproduction started
24
29
End time.Time // time reproduction ended
25
30
Work string // work directory
@@ -122,12 +127,23 @@ func (l *Log) Printf(format string, args ...any) {
122
127
// Run runs the rebuilds indicated by args and returns the resulting report.
123
128
func Run (args []string ) * Report {
124
129
r := & Report {
125
- Start : time .Now (),
126
- Full : runtime .GOOS == "linux" && runtime .GOARCH == "amd64" ,
130
+ Version : "(unknown)" ,
131
+ GoVersion : runtime .Version (),
132
+ GOOS : runtime .GOOS ,
133
+ GOARCH : runtime .GOARCH ,
134
+ Start : time .Now (),
135
+ Full : runtime .GOOS == "linux" && runtime .GOARCH == "amd64" ,
127
136
}
128
137
defer func () {
129
138
r .End = time .Now ()
130
139
}()
140
+ if info , ok := debug .ReadBuildInfo (); ok {
141
+ m := & info .Main
142
+ if m .Replace != nil {
143
+ m = m .Replace
144
+ }
145
+ r .Version = m .Path + "@" + m .Version
146
+ }
131
147
132
148
var err error
133
149
defer func () {
Original file line number Diff line number Diff line change @@ -26,6 +26,9 @@ pre { margin-left: 2em; }
26
26
27
27
{{define "autoopen"}} {{if not (eq . "PASS")}} open {{end}} {{end}}
28
28
29
+ Gorebuild version {{.Version}}.<br>
30
+ Built with Go version {{.GoVersion}}, {{.GOOS}}-{{.GOARCH}}.<br>
31
+ <br>
29
32
Rebuild started at {{.Start.UTC.Format "2006-01-02 15:04:05"}} UTC.<br>
30
33
Rebuild finished at {{.End.UTC.Format "2006-01-02 15:04:05"}} UTC.<br>
31
34
Elapsed time: {{(.End.Sub .Start).Round 1e9}}.
You can’t perform that action at this time.
0 commit comments