增加golang版本获取
This commit is contained in:
parent
908a0097d1
commit
4d4b871d4d
5
git.go
5
git.go
@ -231,6 +231,7 @@ func (g *git) Clone(repo string, saveDir string) *define.Result {
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 22:15 2023/4/9
|
||||
func (g *git) Version() *define.Result {
|
||||
return Execute(g.workDir, g.gitCmdPath, []string{"version"})
|
||||
func (g *git) Version() (string, error) {
|
||||
r := Execute(g.workDir, g.gitCmdPath, []string{"version"})
|
||||
return string(r.Output), r.Error
|
||||
}
|
||||
|
15
golang.go
15
golang.go
@ -21,9 +21,12 @@ import (
|
||||
//
|
||||
// Date : 20:04 2022/5/22
|
||||
func Golang(workDir string, goCmdPath string) *golang {
|
||||
if len(goCmdPath) == 0 {
|
||||
goCmdPath, _ = Check("go")
|
||||
if len(goCmdPath) == 0 {
|
||||
goCmdPath = "go"
|
||||
}
|
||||
}
|
||||
return &golang{
|
||||
workDir: workDir,
|
||||
goCmdPath: goCmdPath,
|
||||
@ -146,7 +149,7 @@ func (g *golang) FormatCode() *define.Result {
|
||||
//
|
||||
// Date : 19:25 2022/6/26
|
||||
func (g *golang) GetGoENV() define.GoENV {
|
||||
result := Execute(g.workDir, "go", []string{"env"})
|
||||
result := Execute(g.workDir, g.goCmdPath, []string{"env"})
|
||||
return g.FormatGoENV(string(result.Output))
|
||||
}
|
||||
|
||||
@ -194,3 +197,13 @@ func (g *golang) SwagInit(param []string) *define.Result {
|
||||
swagCmdPath := envResult.GOPATH + "/bin/swag"
|
||||
return Execute(g.workDir, swagCmdPath, param)
|
||||
}
|
||||
|
||||
// Version 获取版本信息
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 22:42 2023/4/9
|
||||
func (g *golang) Version() (string, error) {
|
||||
result := Execute(g.workDir, g.goCmdPath, []string{"version"})
|
||||
return string(result.Output), result.Error
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user