framework1/framework/command/go_cmd.go

22 lines
411 B
Go
Raw Normal View History

2024-10-22 17:06:36 +08:00
package command
import (
"log"
"os/exec"
"github.com/Superdanda/hade/framework/cobra"
)
// go just run local go bin
var goCommand = &cobra.Command{
Use: "go",
Short: "运行go命令要求go必须安装",
RunE: func(c *cobra.Command, args []string) error {
path, err := exec.LookPath("go")
if err != nil {
log.Fatalln("请在PATH路径中安装go")
}
return runCommand(path, args)
},
}