【发布时间】:2019-10-18 05:12:38
【问题描述】:
我是go-lang 和go-swagger 的新手。我正在关注a blog 并使用命令安装了go-swagger:
go get -u github.com/go-swagger/go-swagger/cmd/swagger
可以看到go-swagger文件夹是在
C:\Go\bin\src\github.com\go-swagger
现在,我将我的项目路径添加到$GOPATH:
echo %GOPATH%
C:\Go\bin;D:\Personal\Learning\GoLang\Project-2;D:\Personal\Learning\GoLang\swagger;
当我跑步时
D:\Personal\Learning\GoLang\swagger>swagger ./swagger.yaml
'swagger' is not recognized as an internal or external command,
operable program or batch file.
我错过了什么?另外,如果您能建议我为go-swagger 提供一些好的材料,我将不胜感激,因为我发现设置所有内容非常困难。没有多少博客可以帮助我进行HELLO WORLD 有点设置
谢谢
更新 1:
我尝试设置GOBIN,但没有成功:
D:\Personal\Learning\GoLang\swagger>swagger validate https://raw.githubusercontent.com/swagger-api/swagger-spec/master/examples/v2.0/json/petstore-expanded.json
'swagger' is not recognized as an internal or external command,
operable program or batch file.
D:\Personal\Learning\GoLang\swagger>echo %GOBIN%
C:\Go\bin\;
更新 2:
我也按照建议尝试了绝对路径,但没有运气:
D:\Personal\Learning\GoLang\swagger>C:\Go\bin\swagger validate https://raw.githubusercontent.com/swagger-api/swagger-spec/master/examples/v2.0/json/petstore-expanded.json
'C:\Go\bin\swagger' is not recognized as an internal or external command,
operable program or batch file.
更新 3:
以下命令对我有用,但似乎不是正确的方法:
go run C:\Go\bin\src\github.com\go-swagger\go-swagger\cmd\swagger\swagger.go validate https://raw.githubusercontent.com/swagger-api/swagger-spec/master/examples/v2.0/json/petstore-expanded.json
【问题讨论】:
-
嗨,这个问题你解决了吗?
标签: go swagger go-swagger