cobra: Cannot init on new module

I’m not sure what I’m doing wrong here.

I’ve installed cobra via: go install github.com/spf13/cobra/cobra

Now, when I run a cobra init, anywhere I get just

Error: exit status 1

I don’t even see where logs are going, or how I can try and debug this. Really, this error code isn’t giving me much at all to go off.

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 17 (2 by maintainers)

Most upvoted comments

I solved it by these steps:

  • run command go mod tidy and go mod vendor
  • run cobra-cli init

cobra-cli init must be run inside of a directory with an existing go.mod. Try running go mod init <MODNAME> first and then cobra-cli init.

Facing the same issue. go1.19.1