Cobra: Not sure why #270 is closed

Created on 29 Sep 2020  路  6Comments  路  Source: spf13/cobra

As per title. Still facing #270

dev@ubuntu:~/Projects/Go/test-proj$ echo $GOROOT
/usr/local/go
dev@ubuntu:~/Projects/Go/test-proj$ echo $GOPATH
/home/dev/go
dev@ubuntu:~/Projects/Go/test-proj$ echo $GOBIN
/home/dev/go/bin
dev@ubuntu:~/Projects/Go/test-proj$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.1 LTS
Release:        20.04
Codename:       focal
dev@ubuntu:~/Projects/Go/test-proj$ go version
go version go1.15.2 linux/amd64
dev@ubuntu:~/Projects/Go/test-proj$ cat ~/.bashrc
...
...
...
# GO paths
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export GOBIN=$HOME/go/bin
export PATH=$GOBIN:$GOROOT/bin:$PATH
dev@ubuntu:~/Projects/Go/test-proj$ cobra init

Command 'cobra' not found, but can be installed with:

sudo apt install cobra

Most helpful comment

@DevDevious I guess you need to go get github.com/spf13/cobra/[email protected]. See #1233, #1234.

All 6 comments

@DevDevious, how did you install cobra?

@umarcor

go get -u github.com/spf13/cobra

@DevDevious, that's for retrieving the library, for you to write your app from scratch. The cobra CLI app is located in https://github.com/spf13/cobra/tree/master/cobra#cobra-generator. Hence, you need to append /cobra.

@umarcor okay. However go get github.com/spf13/cobra/cobra results in:

dev@dev-u20d-a:~/Projects/Go/test-proj$ go get github.com/spf13/cobra/cobra
go: downloading github.com/spf13/cobra v1.0.0
go: downloading github.com/spf13/cobra/cobra v0.0.0-20200916152758-7f8e83d9366a
go: github.com/spf13/cobra/cobra upgrade => v0.0.0-20200916152758-7f8e83d9366a
go get github.com/spf13/cobra/cobra: ambiguous import: found package github.com/spf13/cobra/cobra in multiple modules:
        github.com/spf13/cobra v1.0.0 (/home/dev/go/pkg/mod/github.com/spf13/[email protected]/cobra)
        github.com/spf13/cobra/cobra v0.0.0-20200916152758-7f8e83d9366a (/home/dev/go/pkg/mod/github.com/spf13/cobra/[email protected])

@DevDevious I guess you need to go get github.com/spf13/cobra/[email protected]. See #1233, #1234.

@umarcor I personally agree with the points you made in #1233 . Setup is quite clumsy right now. Going to close this. Thanks @umarcor .

Was this page helpful?
0 / 5 - 0 ratings

Related issues

supershal picture supershal  路  4Comments

andygrunwald picture andygrunwald  路  6Comments

rogercoll picture rogercoll  路  5Comments

mdaymard picture mdaymard  路  5Comments

zevdg picture zevdg  路  5Comments