Feat goctl bug (#1332)

* Support goctl bug

* fix typo

* format code

Co-authored-by: anqiansong <anqiansong@bytedance.com>
This commit is contained in:
anqiansong
2021-12-15 22:43:58 +08:00
committed by GitHub
parent 3d8ad5e4f6
commit 0b17e0e5d9
4 changed files with 126 additions and 0 deletions

32
tools/goctl/bug/env.go Normal file
View File

@@ -0,0 +1,32 @@
package bug
import (
"bytes"
"fmt"
"runtime"
"github.com/tal-tech/go-zero/tools/goctl/internal/version"
)
type env map[string]string
func (e env) string() string {
if e == nil {
return ""
}
w := bytes.NewBuffer(nil)
for k, v := range e {
w.WriteString(fmt.Sprintf("%s = %q\n", k, v))
}
return w.String()
}
func getEnv() env {
e := make(env)
e[os] = runtime.GOOS
e[arch] = runtime.GOARCH
e[goctlVersion] = version.BuildVersion
return e
}