framework1/framework/command/go_cmd.go

22 lines
411 B
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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)
},
}