I am trying to setup swagger for gin-gonic on windows. Documentation of swaggo states that I should run:
go get -u github.com/swaggo/swag/cmd/swag
After installation I should be able to run swag init
from within the root of my project where I have main.go
, but the cmdlet states the following:
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
How can I add swag to PATH or how should I proceed from here?
Ps, i followed documentation from here
Update: So I did a clean installation of Go on another PC, followed by go get -u github.com/swaggo/swag/cmd/swag
and swag
runs right of the bat. Earlier I followed this tutorial and I might have accidentally messed up my $GOPATH
on the original PC.
add $GOPATH/bin to PATH, for example:
export PATH=$PATH:/Users/.../go/bin