0

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!

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
Amal
  • 545
  • 6
  • 19
  • Did you try installing the pflag package? I'm guessing you do have it installed, and don't realize it, otherwise you'd get a different error. – Jonathan Hall Apr 21 '17 at 20:59
  • Did you actually run `glide`? Or did you just put it in the `glide.yaml`? Usually, glide should take care of the dependencies for you. – Martin Tournoij Apr 21 '17 at 21:00
  • @Flimzy pflag package is automatically installed and is present in my vendor dir. ls on ./vendor/github.com/spf13/ gives output cobra pflag – Amal Apr 22 '17 at 05:53
  • @Carpetsmoker obviously I did a glide install :) – Amal Apr 22 '17 at 05:57

1 Answers1

1

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

Amal
  • 545
  • 6
  • 19