windows - 在 Windows 上安装 swagger (swagger + gin)
问题描述
我正在尝试在 Windows 上为 gin-gonic 设置招摇。swago 的文档说明我应该运行:
go get -u github.com/swaggo/swag/cmd/swag
安装后,我应该能够swag init
从我拥有的项目的根目录中运行main.go
,但 cmdlet 声明如下:
swag : The term 'swag' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ swag
+ ~~~~
+ CategoryInfo : ObjectNotFound: (swag:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
如何将赃物添加到 PATH 或者我应该如何从这里开始?
Ps,我从这里关注了文档
更新:所以我在另一台 PC 上进行了 Go 的全新安装,然后go get -u github.com/swaggo/swag/cmd/swag
直接swag
运行。早些时候我遵循了本教程,我可能不小心弄乱了我$GOPATH
原来的 PC。
解决方案
将 $GOPATH/bin 添加到 PATH,例如:
导出 PATH=$PATH:/Users/.../go/bin
推荐阅读
- database - OpenEdge 10.2A - 仅使用 .d1 和旧版本的 .db 文件生成数据库文件
- python - 对列中的所有行对执行操作
- domino-designer-eclipse - Domino Designer V10 性能问题
- django - 使用表单集工厂更新视图不起作用
- php - 带有学说的 Symfony 4:警告:发送 QUERY 数据包时出错。PID=2989
- chart.js - Chart.js 甚至在 x 轴下方显示条形溢出
- sql-server - 当 Powershell 执行时,SQL 作业步骤不会失败
- javascript - 当我使用 JS 拨打电话时,从 google api 获得 2 个响应
- php - 如何在同一视图页面上使用 laravel 更新数据库?
- python - Python 反编译器 uncompyle6 未知变量名字符