Swag: I cloud not install swag as the guide from readme

Created on 16 Apr 2018  路  4Comments  路  Source: swaggo/swag

Hi team,
Thanks so much for your work.

Update: I fixed it! You must to set GOPATH env in case you have custom GOROOT env.

I have an installation issue: the installation is done without error, but the command is not found.
I'm using Ubuntu 14

go get -v -u github.com/swaggo/swag/cmd/swag

github.com/swaggo/swag (download)
github.com/ghodss/yaml (download)
Fetching https://gopkg.in/yaml.v2?go-get=1
Parsing meta tags from https://gopkg.in/yaml.v2?go-get=1 (status code 200)
get "gopkg.in/yaml.v2": found meta tag get.metaImport{Prefix:"gopkg.in/yaml.v2", VCS:"git", RepoRoot:"https://gopkg.in/yaml.v2"} at https://gopkg.in/yaml.v2?go-get=1
gopkg.in/yaml.v2 (download)
github.com/go-openapi/jsonreference (download)
github.com/PuerkitoBio/purell (download)
github.com/PuerkitoBio/urlesc (download)
Fetching https://golang.org/x/net/idna?go-get=1
Parsing meta tags from https://golang.org/x/net/idna?go-get=1 (status code 200)
get "golang.org/x/net/idna": found meta tag get.metaImport{Prefix:"golang.org/x/net", VCS:"git", RepoRoot:"https://go.googlesource.com/net"} at https://golang.org/x/net/idna?go-get=1
get "golang.org/x/net/idna": verifying non-authoritative meta tag
Fetching https://golang.org/x/net?go-get=1
Parsing meta tags from https://golang.org/x/net?go-get=1 (status code 200)
golang.org/x/net (download)
Fetching https://golang.org/x/text/secure/bidirule?go-get=1
Parsing meta tags from https://golang.org/x/text/secure/bidirule?go-get=1 (status code 200)
get "golang.org/x/text/secure/bidirule": found meta tag get.metaImport{Prefix:"golang.org/x/text", VCS:"git", RepoRoot:"https://go.googlesource.com/text"} at https://golang.org/x/text/secure/bidirule?go-get=1
get "golang.org/x/text/secure/bidirule": verifying non-authoritative meta tag
Fetching https://golang.org/x/text?go-get=1
Parsing meta tags from https://golang.org/x/text?go-get=1 (status code 200)
golang.org/x/text (download)
Fetching https://golang.org/x/text/transform?go-get=1
Parsing meta tags from https://golang.org/x/text/transform?go-get=1 (status code 200)
get "golang.org/x/text/transform": found meta tag get.metaImport{Prefix:"golang.org/x/text", VCS:"git", RepoRoot:"https://go.googlesource.com/text"} at https://golang.org/x/text/transform?go-get=1
get "golang.org/x/text/transform": verifying non-authoritative meta tag
Fetching https://golang.org/x/text/unicode/bidi?go-get=1
Parsing meta tags from https://golang.org/x/text/unicode/bidi?go-get=1 (status code 200)
get "golang.org/x/text/unicode/bidi": found meta tag get.metaImport{Prefix:"golang.org/x/text", VCS:"git", RepoRoot:"https://go.googlesource.com/text"} at https://golang.org/x/text/unicode/bidi?go-get=1
get "golang.org/x/text/unicode/bidi": verifying non-authoritative meta tag
Fetching https://golang.org/x/text/unicode/norm?go-get=1
Parsing meta tags from https://golang.org/x/text/unicode/norm?go-get=1 (status code 200)
get "golang.org/x/text/unicode/norm": found meta tag get.metaImport{Prefix:"golang.org/x/text", VCS:"git", RepoRoot:"https://go.googlesource.com/text"} at https://golang.org/x/text/unicode/norm?go-get=1
get "golang.org/x/text/unicode/norm": verifying non-authoritative meta tag
Fetching https://golang.org/x/text/width?go-get=1
Parsing meta tags from https://golang.org/x/text/width?go-get=1 (status code 200)
get "golang.org/x/text/width": found meta tag get.metaImport{Prefix:"golang.org/x/text", VCS:"git", RepoRoot:"https://go.googlesource.com/text"} at https://golang.org/x/text/width?go-get=1
get "golang.org/x/text/width": verifying non-authoritative meta tag
github.com/go-openapi/jsonpointer (download)
github.com/go-openapi/swag (download)
github.com/mailru/easyjson (download)
github.com/go-openapi/spec (download)
github.com/urfave/cli (download)

swag init

No command 'swag' found, did you mean:
 Command 'swig' from package 'swig' (main)
 Command 'swab' from package 'odin' (universe)
swag: command not found

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 4 comments

Is It done?

Thanks @pei0804
Update: I fixed it! You must to set GOPATH env in case you have custom GOROOT env.

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 After running go get -v -u github.com/swaggo/swag/cmd/swag, I see swag in $HOME/go/bin. I tried swag init but I got "-bash: swag: command not found"
I also cd to $HOME/go/bin and tried swag init but got samething - "-bash: swag: command not found". I am very new to Golang. Can you please help?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wuhuizuo picture wuhuizuo  路  4Comments

dz0ny picture dz0ny  路  5Comments

fannheyward picture fannheyward  路  3Comments

chiragg6 picture chiragg6  路  7Comments

Ashtonian picture Ashtonian  路  6Comments