windows 下载依赖包 go get github.com/swaggo/swag/cmd/swag 编译swag cd $GOPATH\pkg\mod\github.com\swaggo\swag@v1.16.2\cmd\swag ps: go env 获取 GOPATH位置 go install ps: 此时 $GOPATH\bin下出现了 swag.exe 项目根目录下执行swag 初始化 swag init 生成结果