Update template (#1335)

Co-authored-by: anqiansong <anqiansong@bytedance.com>
master
anqiansong 3 years ago committed by GitHub
parent 0b17e0e5d9
commit 5979b2aa0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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

@ -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
}

@ -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>
$ goctl --version
%s
</pre>
### Does this issue reproduce with the latest release?
</pre>
2. The error is
### What operating system and processor architecture are you using ?
<pre>
%s
</pre>
<pre>
### What did you do?
</pre>
<!--
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
-->
**Expected behavior**
<!-- A clear and concise description of what you expected to happen. -->
**Screenshots**
<!-- If applicable, add screenshots to help explain your problem. -->
**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
### What did you expect to see?
### What did you see instead?
**More description**
<!-- Add any other context about the problem here. -->
`

Loading…
Cancel
Save