I am following this guide.
***@pop-os:~/go/src/foo$ cobra init --pkg-name foo
Command 'cobra' not found, but can be installed with:
sudo apt install cobra
My setup:
I have go 1.16 installed
$ go version
go version go1.16.3 linux/amd64
my $GOPATH is set to ~/go
$ go env
...
GOPATH="/home/***/go"
What I have done: I used the command
$ go get -u github.com/spf13/cobra/cobra
In my bin's dir I now find cobra
***@pop-os:~/go/bin$ ls
cobra
...
What am I doing wrong?
alias cobra="~/go/bin/cobra"
since it is already in the path – Stateroomcannot find package "github.com/hashicorp/hcl/hcl/printer
, then simply enable Go modules and try again viaenv GO111MODULE=on go get github.com/spf13/cobra/cobra
. – Transfuse