我是新手go-lang
,等等go-swagger
。我正在关注一个博客并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