mirror of
https://github.com/zeromicro/go-zero.git
synced 2025-01-24 17:52:49 +08:00
cd289465fd
* chore: coding style and comments * chore: optimize `ParseJsonBody` (#1353) * chore: optimize `ParseJsonBody` * chore: optimize `ParseJsonBody` * fix: fix a test * chore: optimize `ParseJsonBody` * fix a test * chore: add comment * chore: refactor Co-authored-by: chenquan <chenquan.dev@foxmail.com>
35 lines
537 B
Go
35 lines
537 B
Go
package bug
|
|
|
|
import (
|
|
"bytes"
|
|
"fmt"
|
|
"runtime"
|
|
"strings"
|
|
|
|
"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 strings.TrimSuffix(w.String(), "\n")
|
|
}
|
|
|
|
func getEnv() env {
|
|
e := make(env)
|
|
e[os] = runtime.GOOS
|
|
e[arch] = runtime.GOARCH
|
|
e[goctlVersion] = version.BuildVersion
|
|
e[goctlVersion] = runtime.Version()
|
|
return e
|
|
}
|