error on installing cobra package using command go get github.com/spf13/cobra

77 views
Skip to first unread message

akhil agrawal

unread,
Mar 15, 2023, 2:10:39 PM3/15/23
to golang-nuts
Hi Team, i am getting following error
go get github.com/spf13/cobra github.com/spf13/cobra imports github.com/spf13/pflag: cannot find module providing package github.com/spf13/pflag
on go get github.com/spf13/cobra command,.
Can someone suggest?

Ian Lance Taylor

unread,
Mar 15, 2023, 2:50:16 PM3/15/23
to akhil agrawal, golang-nuts
Works for me. What version of go are you using?

Ian

Akhil Agrawal

unread,
Mar 16, 2023, 11:56:20 AM3/16/23
to golang-nuts

tried with 1.12,1.16,1.19,1.20

Ian Lance Taylor

unread,
Mar 16, 2023, 12:26:43 PM3/16/23
to Akhil Agrawal, golang-nuts
On Thu, Mar 16, 2023 at 8:56 AM 'Akhil Agrawal' via golang-nuts
<golan...@googlegroups.com> wrote:
>
> tried with 1.12,1.16,1.19,1.20

This works for me, starting in an empty directory, with Go 1.20.

> go mod init example.com
go: creating new go.mod: module example.com
> go get github.com/spf13/cobra
go: added github.com/inconshreveable/mousetrap v1.0.1
go: added github.com/spf13/cobra v1.6.1
go: added github.com/spf13/pflag v1.0.5

Are you using any sort of Go module proxy? What does "go env" print?

Ian
> --
> You received this message because you are subscribed to the Google Groups "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/f296b0e5-100b-441b-8c00-e997c0cc5c6cn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages