Selaa lähdekoodia

Update template (#1335)

Co-authored-by: anqiansong <anqiansong@bytedance.com>
anqiansong 3 vuotta sitten
vanhempi
sitoutus
5979b2aa0f
3 muutettua tiedostoa jossa 34 lisäystä ja 27 poistoa
  1. 4 2
      tools/goctl/bug/bug.go
  2. 3 1
      tools/goctl/bug/env.go
  3. 27 24
      tools/goctl/bug/issue.go

+ 4 - 2
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, "<pre>\n"+env.string()+"</pre>")
+	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

+ 3 - 1
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
 }

+ 27 - 24
tools/goctl/bug/issue.go

@@ -1,39 +1,42 @@
 package bug
 
 const issueTemplate=`
-<!-- Please submit an issue order by the following template. Thanks! -->
+<!-- Please answer these questions before submitting your issue. Thanks! -->
 
-**Describe the bug**
-<!-- A clear and concise description of what the bug is. -->
+### What category of issue (<code>goctl</code> or <code>sdk</code>)?
 
-**To Reproduce**
-<!-- Steps to reproduce the behavior, if applicable: -->
+### What type of issue (<code>feature</code>|<code>bug</code>|<code>suggestion</code>)?
 
-1. The code is
+### What version of Goctl are you using (<code>goctl --version</code>)?
 
-	<pre>
-	
-	</pre>
+<pre>
+$ goctl --version
+%s
+</pre>
 
-2. The error is
+### Does this issue reproduce with the latest release?
 
-	<pre>
-	
-	</pre>
 
-**Expected behavior**
-<!-- A clear and concise description of what you expected to happen. -->
+### What operating system and processor architecture are you using ?
+<pre>
+%s
+</pre>
 
-**Screenshots**
-<!-- If applicable, add screenshots to help explain your problem. -->
+### What did you do?
 
-**Environments (please complete the following information):**
-<!--  - OS: [e.g. Linux]
- - go-zero version [e.g. 1.2.1]
- - goctl version [e.g. 1.2.1, optional] -->
-%s
+<!--
+If possible, provide a recipe for reproducing the error.
+A complete runnable program is good.
+A link on play.golang.org is best.
+-->
+
+
+
+### What did you expect to see?
+
+
+
+### What did you see instead?
 
-**More description**
-<!-- Add any other context about the problem here. -->
 
 `