package initialize import ( "bytes" "fmt" "os" "os/exec" ) // SwagInit 初始化swag http://localhost:8000/swagger/index.html func SwagInit() { cmd := exec.Command("swag", "init") fmt.Println("Cmd", cmd.Args) var out bytes.Buffer cmd.Stdout = &out cmd.Stderr = os.Stderr if err := cmd.Start(); err != nil { fmt.Println(err) } fmt.Println(out.String()) }