My glide.yaml import section is
import:
- package: github.com/spf13/cobra
I have below import statement in my code
import (
"github.com/spf13/cobra"
)
But when trying to compile I am getting below error from cobra package
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)
The pflag package is installed too, an ls on ./vendor/github.com/spf13/ gives output cobra pflag. Is there something wrong with what I am doing? The docs say to just install cobra package and import it
You should update github.com/spf13/pflag package
I didn't really have the pflag package installed separately. I got it installed with cobra when I ran glide install. won't that be the correct version?
Yes, it's not the correct version. The pflag's version should be at least https://github.com/spf13/pflag/commit/d90f37a48761fe767528f31db1955e4f795d652f. Try to execute glide up, but really I'm not sure what it will fix the issue, because I haven't got any experience with glide at all.
Thanks for guiding, glide up didn't work. I manually edited glide.lock pflag's version to d90f37a and removed vendor dir, ran a glide install again. now it works. Strange thing is that now I deleted lock file and vendor directory and ran glide install again, its d90f37a everytime
glide cache seems to create the issues here. I did glide clear-cacheglide cache-clear and now its again fetching latest version.
glide update isn't update the cache, why it didn't fetch latest version. They seem to already have an issue open for it: https://github.com/Masterminds/glide/issues/806
@bogem wholehearted thanks for the help :+1: , really appreciate your time
You're welcome!
@amalfra it's glide cache-clear and thanks for the solution :smile_cat:
@at15 sorry, it was a typo :smile:. You're welcome!
Most helpful comment
glide cache seems to create the issues here. I did
glide clear-cacheglide cache-clearand now its again fetching latest version.glide update isn't update the cache, why it didn't fetch latest version. They seem to already have an issue open for it: https://github.com/Masterminds/glide/issues/806
@bogem wholehearted thanks for the help :+1: , really appreciate your time