英文:
error adding golang cobra package with glide
问题
我的glide.yaml导入部分是这样的:
import:
- package: github.com/spf13/cobra
我的代码中有这样的导入语句:
import (
"github.com/spf13/cobra"
)
但是我遇到了以下错误:
> vendor/github.com/spf13/cobra/command.go:1092: c.lflags.SortFlags undefined (type *pflag.FlagSet has no field or method SortFlags)
> vendor/github.com/spf13/cobra/command.go:1092: c.Flags().SortFlags undefined (type *pflag.FlagSet has no field or method SortFlags)
> vendor/github.com/spf13/cobra/command.go:1240: c.parentsPflags.SortFlags undefined (type *pflag.FlagSet has no field or method SortFlags)
cobra仓库中的一些问题说,如果pflag包是旧版本,可能会出现这种情况,但在我的情况下,我没有单独安装该包。你知道我做错了什么吗?提前感谢!
英文:
My glide.yaml import section is
import:
- package: github.com/spf13/cobra
I have
import (
"github.com/spf13/cobra"
)
in my code.
but I am getting the error
> vendor/github.com/spf13/cobra/command.go:1092: c.lflags.SortFlags undefined (type *pflag.FlagSet has no field or method SortFlags)
> vendor/github.com/spf13/cobra/command.go:1092: c.Flags().SortFlags undefined (type *pflag.FlagSet has no field or method SortFlags)
> vendor/github.com/spf13/cobra/command.go:1240: c.parentsPflags.SortFlags undefined (type *pflag.FlagSet has no field or method SortFlags)
couples of issues on cobra repo says that can happen if pflag package is old version but in my case don't have that package installed separately.
any idea what am I doing wrong? thanks in advance!
答案1
得分: 1
这是有关Glide缓存未更新的问题,导致安装了旧版本的pflag包。更详细的信息请参考:https://github.com/spf13/cobra/issues/420
英文:
It was problem with glide cache not updating why old version of pflag package was getting installed. More detailed info: https://github.com/spf13/cobra/issues/420
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论