alecthomas / kingpin

CONTRIBUTIONS ONLY: A Go (golang) command line and flag parser
MIT License
3.51k stars 273 forks source link

values.go:142:25: undefined: str2duration.Str2Duration #334

Open xer-rex opened 1 year ago

xer-rex commented 1 year ago

Hi,

I see the v2.3.0 was out 3 days ago, and my module picked up the new change in values.go. There are problems while building my go script using the kingpin

 [exec] ../vendor/gopkg.in/alecthomas/kingpin.v2/values.go:142:25: undefined: str2duration.Str2Duration

do i understand as the https://github.com/xhit/go-str2duration/blob/master/str2duration.go does not have the Str2Duration function?

alecthomas commented 1 year ago

If you want this fixed you'll need to send a PR to fix it.

xer-rex commented 1 year ago

Thx for the reply. I'm sorry, I don't have go lang experience; i'm just maintaining other people's modules in my CI pipeline and learning to troubleshoot the build issue/failure. I will try to see what I can do. Thx for your time.

codelav commented 1 year ago

@xer-rex I use this package as a dependency in another one and faced with the same issue. This might help you https://github.com/go-jose/go-jose/pull/34

xer0616 commented 1 year ago

Thx @codelav , i use kingpin.v1 at this moment.

alecthomas commented 1 year ago

Kingpin is correctly using v1 of this package, which does have the Str2Duration function. I don't know why your builds are failing, but I suspect somehow they're not pulling in the correct version.

xer0616 commented 1 year ago

Hi @alecthomas ,

I tried to create a pull request to use ParseDuration to fix my problem; however, it failed because the go.mod of this project uses go-str2duration v1.2.0 , it has Str2Duration only; therefore, your project does not have any problems. My module takes go-str2duration latest, it has ParseDuration only. Since i don't have go lang experience, i simply used kingpin.v1, which used ParseDuration in values.go, to workaround my compilation issue. :)