Error: unknown flag: --pkg-name when cobra-cli init
samozturk opened this issue · comments
Hi, noob here. I have been trying to learn to use cobra, all the tutorials uses --pkg-name flag. However when I use it like this
cobra-cli init --pkg-name=github.com/samozturk/randompackage
it says Error: unknown flag: --pkg-name Usage: cobra-cli init [path] [flags]
Are these tutorials outdated or am I doing something wrong?
Hi @samozturk - thanks for opening this. I've transferred this over to spf13/cobra-cli
since this is where the cobra bootstrapping utility lives now.
Cool you've been learning to use cobra!
There isn't a pkg-name
flag. You want to declare your package name via the go mod initialization:
go mod init github.com/samozturk/randompackage
You can read more about it in the init
documentation
Good luck! 👏🏼