12345678910111213141516171819202122 |
- 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())
- }
|