Swag: Can't install swag

Created on 18 Sep 2018  Â·  11Comments  Â·  Source: swaggo/swag

Describe the bug
I'm unable to install swag given the instructions on the README

To Reproduce
Steps to reproduce the behavior:

  1. Execute go get github.com/swaggo/swag/cmd/swag on the command line
  2. See the following error:
go get github.com/swaggo/swag/cmd/swag
# github.com/ghodss/yaml
./yaml.go:102:28: undefined: yaml.UnmarshalStrict
  1. Try to run swag
  2. See the following error:
zsh: command not found: swag

Expected behavior
swag should be installed properly on my machine.

Desktop (please complete the following information):

  • OS: macOS High Sierra
  • Version: go version go1.10.3 darwin/amd64

@pei0804

question

Most helpful comment

Path variable must be set:
After running go get -v -u github.com/swaggo/swag/cmd/swag
Please check /usr/local/go/bin or $HOME/go/bin where those swag executable is present.

Make sure you have that PATH in /etc/profile or $HOME/.profile

e.g. export PATH=$PATH:$HOME/go/bin

All 11 comments

@jdiedrick Looks like you have older github.com/ghodss/yaml version at local, please add the -u flag when getting swag like:
go get -u github.com/swaggo/swag/cmd/swag

@jasonhancock please reopen it if you have any questions.

Followed the recommendation and still "zsh: command not found: swag"

I have installed swag as follows: go get -u github.com/swaggo/swag/cmd/swag. But when I run "swag", I got error like: -bash: swag: command not found. how can I resolved this issue? thanks.
Mac OS version: 10.14.3 and golang version: go1.11 darwin/amd64

@stiffer-cl the binary will likely have been installed to $GOPATH/bin/swag. Run if from there or copy the file from there to somplace in your $PATH

Thanks, I was able to resolve the issue by using the full path to the swag code base as you recommended.

From: Jason Hancock notifications@github.com
Reply-To: swaggo/swag reply@reply.github.com
Date: Wednesday, February 13, 2019 at 12:08 PM
To: swaggo/swag swag@noreply.github.com
Cc: Michael Roof michael@myhomegenius.com, Comment comment@noreply.github.com
Subject: Re: [swaggo/swag] Can't install swag (#209)

@stiffer-clhttps://github.com/stiffer-cl the binary will likely have been installed to $GOPATH/bin/swag. Run if from there or copy the file from there to somplace in your $PATH

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHubhttps://github.com/swaggo/swag/issues/209#issuecomment-463304748, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Aq1XvxG21Do0mFrJf6Q4_OAQQRJIFtd2ks5vNFR_gaJpZM4WuMZl.

Path variable must be set:
After running go get -v -u github.com/swaggo/swag/cmd/swag
Please check /usr/local/go/bin or $HOME/go/bin where those swag executable is present.

Make sure you have that PATH in /etc/profile or $HOME/.profile

e.g. export PATH=$PATH:$HOME/go/bin

Hi @pnutmath @jasonhancock I did the following

  1. Ran go get -v -u github.com/swaggo/swag/cmd/swag
  2. I see swag in $HOME/go/bin
  3. I then tried running swag init in my work space where I have my main.go but I got "-bash: swag: command not found".
  4. I then ran swag init in $HOME/go/bin and I got the same error

I am new to Golang. Can you please help?

@hariraogotit from the directory with your main.go, run $HOME/go/bin/swag or add $HOME/go/bin to your $PATH, or copy $HOME/go/bin/swag to a directory in your $PATH

@hariraogotit from the directory with your main.go, run $HOME/go/bin/swag or add $HOME/go/bin to your $PATH, or copy $HOME/go/bin/swag to a directory in your $PATH

thank you very much that worked

@jasonhancock, please use export PATH=$(go env GOPATH)/bin:$PATH

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chyroc picture chyroc  Â·  3Comments

hoangtuan151 picture hoangtuan151  Â·  4Comments

zhongkeqin picture zhongkeqin  Â·  4Comments

LennyPenny picture LennyPenny  Â·  4Comments

touyu picture touyu  Â·  3Comments