无法使用”go cobra init –pkg-name demo”命令初始化一个新的包。

huangapple go评论60阅读模式
英文:

Unable to initialize a new package using cobra init --pkg-name demo command in go

问题

cobra init --pkg-name demo
错误:未知标志:--pkg-name
用法:
  cobra init [路径] [标志]

别名:
  init, initialize, initialise, create

标志:
  -h, --help   帮助 init

全局标志:
  -a, --author string    作者姓名以进行版权归属(默认值为“YOUR NAME”)
      --config string    配置文件(默认值为 $HOME/.cobra.yaml)
  -l, --license string   项目的许可证名称
      --viper            使用 Viper 进行配置

这个问题显示了一个错误,你想知道如何解决它吗?

英文:
cobra init --pkg-name demo
Error: unknown flag: --pkg-name
Usage:
  cobra init [path] [flags]

Aliases:
  init, initialize, initialise, create

Flags:
  -h, --help   help for init

Global Flags:
  -a, --author string    author name for copyright attribution (default "YOUR NAME")
      --config string    config file (default is $HOME/.cobra.yaml)
  -l, --license string   name of license for the project
      --viper            use Viper for configuration

It shows me this issue. How do i solve this?

答案1

得分: 1

你可能正在使用旧版本?

尝试使用 cobra init demo 命令

更多详细信息请参考这里这里

英文:

You might be using an old version?

Try cobra init demo

See here and here for more details

huangapple
  • 本文由 发表于 2022年4月20日 23:55:28
  • 转载请务必保留本文链接:https://go.coder-hub.com/71942726.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定