digitalocean / doctl

The official command line interface for the DigitalOcean API.
https://docs.digitalocean.com/reference/doctl/
Apache License 2.0
3.26k stars 397 forks source link

Dependency inconsistency caused by `replace` #1574

Closed HappyHacker123 closed 2 months ago

HappyHacker123 commented 2 months ago

What is the problem this feature would solve? Please describe. Currently doctl depends on github.com/digitalocean/godo v1.121.0 but do not follow to use the replace directive declared in godo's go.mod as below. Repo godo uses replace directive to pin github.com/stretchr/objx to version v0.2.0 and golang.org/x/crypto to version v0.0.0-20200420201142-3c4aac89819a.

replace github.com/stretchr/objx => github.com/stretchr/objx v0.2.0
replace golang.org/x/crypto => golang.org/x/crypto v0.0.0-20200420201142-3c4aac89819a

According to Go Modules wikis, replace directives in modules other than the main module are ignored when building the main module. It means such replace usage in go.mod cannot be inherited by downstream projects automatically. Consequently, doctl's version of github.com/stretchr/objx and golang.org/x/crypto is different from the pinned version github.com/digitalocean/godo needed.

Possible Solution.

  1. Remove the replace usage in github.com/digitalocean/godo.
  2. Add the same replace rule to your go.mod
    replace github.com/stretchr/objx => github.com/stretchr/objx v0.2.0
    replace golang.org/x/crypto => golang.org/x/crypto v0.0.0-20200420201142-3c4aac89819a
HappyHacker123 commented 2 months ago

Could you please take a look at this issue @loosla @andrewsomething ? Many thanks :)

andrewsomething commented 2 months ago

Thanks for flagging this @HappyHacker123 It should be resolved via https://github.com/digitalocean/godo/pull/723