Skip to content

Commit

Permalink
chore: gno version output in gno bug body
Browse files Browse the repository at this point in the history
  • Loading branch information
thehowl committed Feb 6, 2025
1 parent 0b76b0b commit 327bc0f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
14 changes: 9 additions & 5 deletions gnovm/cmd/gno/bug.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"text/template"
"time"

"github.com/gnolang/gno/gnovm/pkg/version"
"github.com/gnolang/gno/tm2/pkg/commands"
)

Expand All @@ -23,9 +24,10 @@ Describe your issue in as much detail as possible here
### Your environment
* Go version: {{.GoVersion}}
* OS and CPU architecture: {{.Os}}/{{.Arch}}
* Gno commit hash causing the issue: {{.Commit}}
* Gno version: {{ .GnoVersion }}
* Go version: {{ .GoVersion }}
* OS and CPU architecture: {{ .Os }}/{{ .Arch }}
* Gno commit hash causing the issue: {{ .Commit }}
### Steps to reproduce
Expand Down Expand Up @@ -62,10 +64,11 @@ func newBugCmd(io commands.IO) *commands.Command {
Name: "bug",
ShortUsage: "bug",
ShortHelp: "start a bug report",
LongHelp: `opens https://github.com/gnolang/gno/issues in a browser.
LongHelp: `opens https://github.com/gnolang/gno/issues in a browser.
The new issue body is prefilled for you with the following information:
- Gno version (the output of "gno version")
- Go version (example: go1.22.4)
- OS and CPU architecture (example: linux/amd64)
- Gno commit hash causing the issue (example: f24690e7ebf325bffcfaf9e328c3df8e6b21e50c)
Expand Down Expand Up @@ -96,10 +99,11 @@ func execBug(cfg *bugCfg, args []string, io commands.IO) error {
}

bugReportEnv := struct {
Os, Arch, GoVersion, Commit string
Os, Arch, GnoVersion, GoVersion, Commit string
}{
runtime.GOOS,
runtime.GOARCH,
version.Version,
runtime.Version(),
getCommitHash(),
}
Expand Down
10 changes: 7 additions & 3 deletions gnovm/cmd/gno/bug_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,21 @@ import "testing"
func TestBugApp(t *testing.T) {
tc := []testMainCase{
{
args: []string{"bug -h"},
errShouldBe: "flag: help requested",
args: []string{"bug", "-h"},
errShouldContain: "flag: help requested",
},
{
args: []string{"bug unknown"},
args: []string{"bug", "unknown"},
errShouldBe: "flag: help requested",
},
{
args: []string{"bug", "-skip-browser"},
stdoutShouldContain: "Go version: go1.",
},
{
args: []string{"bug", "-skip-browser"},
stdoutShouldContain: "Gno version: develop",
},
}
testMainCaseRun(t, tc)
}

0 comments on commit 327bc0f

Please sign in to comment.