cobra icon indicating copy to clipboard operation
cobra copied to clipboard

please. help with first project on a windows machine

Open realtebo opened this issue 1 year ago • 2 comments

Hi !

This is my first time with cobra

i am working on a windows machine, windows 11

I have go 1.20.1 just installed

I created a new folder for my project

I executed a go mod init

Then i executed, from a terminal, from inside the project folder

go get -u github.com/spf13/cobra/cobra

Like home page says here: https://cobra.dev/#install

But i get

| go: module github.com/spf13/cobra@upgrade found (v1.6.1), but does not contain package github.com/spf13/cobra/cobra

So what is the right way to start a project, on windows?

I specify on Windows because I see a lot of tutorials about linux/mac and they told to use a bin/cobra init command that I am not able to find

Also, I found a broken link when looking for infos

in the home page, at the text following

 [Here](https://github.com/spf13/cobra/blob/master/cobra/README.md) you can find more information about it.

The link is broken...

realtebo avatar Mar 02 '23 19:03 realtebo

I think you want to use go install github.com/spf13/cobra-cli@latest as specified here: https://github.com/spf13/cobra#usage

I'm in the same boat as you, trying to develop my first Go app.

egerlach avatar Aug 08 '23 20:08 egerlach

cobra-cli is a CLI tool for generating boilerplate code. Don't confuse it with the cobra package itself.

To use the cobra package, import "github.com/spf13/cobra" and run go mod tidy

crazyoptimist avatar Apr 08 '24 20:04 crazyoptimist