From 5979b2aa0f7c01242ec85f35176a25bf98c49fd0 Mon Sep 17 00:00:00 2001 From: anqiansong Date: Wed, 15 Dec 2021 23:24:32 +0800 Subject: [PATCH] Update template (#1335) Co-authored-by: anqiansong --- tools/goctl/bug/bug.go | 6 ++-- tools/goctl/bug/env.go | 4 ++- tools/goctl/bug/issue.go | 59 +++++++++++++++++++++------------------- 3 files changed, 38 insertions(+), 31 deletions(-) diff --git a/tools/goctl/bug/bug.go b/tools/goctl/bug/bug.go index 65d0eaa2..07d4a0eb 100644 --- a/tools/goctl/bug/bug.go +++ b/tools/goctl/bug/bug.go @@ -6,6 +6,7 @@ import ( "os/exec" "runtime" + "github.com/tal-tech/go-zero/tools/goctl/internal/version" "github.com/urfave/cli" ) @@ -20,6 +21,7 @@ const ( os = "OS" arch = "ARCH" goctlVersion = "GOCTL_VERSION" + goVersion = "GO_VERSION" ) var openCmd = map[string]string{ @@ -29,9 +31,9 @@ var openCmd = map[string]string{ func Action(_ *cli.Context) error { env := getEnv() - content := fmt.Sprintf(issueTemplate, "
\n"+env.string()+"
") + content := fmt.Sprintf(issueTemplate, version.BuildVersion, env.string()) content = url.QueryEscape(content) - url := fmt.Sprintf("https://github.com/zeromicro/go-zero/issues/new?title=TODO&body=%s", content) + url := fmt.Sprintf("https://github.com/zeromicro/go-zero/issues/new?body=%s", content) goos := runtime.GOOS var cmd string diff --git a/tools/goctl/bug/env.go b/tools/goctl/bug/env.go index 4ca90c7f..6f954520 100644 --- a/tools/goctl/bug/env.go +++ b/tools/goctl/bug/env.go @@ -4,6 +4,7 @@ import ( "bytes" "fmt" "runtime" + "strings" "github.com/tal-tech/go-zero/tools/goctl/internal/version" ) @@ -20,7 +21,7 @@ func (e env) string() string { w.WriteString(fmt.Sprintf("%s = %q\n", k, v)) } - return w.String() + return strings.TrimSuffix(w.String(),"\n") } func getEnv() env { @@ -28,5 +29,6 @@ func getEnv() env { e[os] = runtime.GOOS e[arch] = runtime.GOARCH e[goctlVersion] = version.BuildVersion + e[goctlVersion] = runtime.Version() return e } diff --git a/tools/goctl/bug/issue.go b/tools/goctl/bug/issue.go index 1757e0f6..c3cd0981 100644 --- a/tools/goctl/bug/issue.go +++ b/tools/goctl/bug/issue.go @@ -1,39 +1,42 @@ package bug const issueTemplate=` - + -**Describe the bug** - +### What category of issue (goctl or sdk)? -**To Reproduce** - +### What type of issue (feature|bug|suggestion)? -1. The code is +### What version of Goctl are you using (goctl --version)? -
-	
-	
- -2. The error is - -
-	
-	
- -**Expected behavior** - - -**Screenshots** - - -**Environments (please complete the following information):** - +
+$ goctl --version
 %s
+
+ +### Does this issue reproduce with the latest release? + + +### What operating system and processor architecture are you using ? +
+%s
+
+ +### What did you do? + + + + + +### What did you expect to see? + + + +### What did you see instead? -**More description** - `