signalfx / golib

Golib contains various useful golang libraries
Apache License 2.0
69 stars 18 forks source link

Signalfx breaks go mod tidy due to issues with smartystreets imports #253

Closed josev94 closed 1 month ago

josev94 commented 1 year ago

Problem Go mod tidy has stopped working for go.mod that imports signalfx due to issues with the smartystreets imports. This seems to happen specifically when the dependency is 2 or more levels deep (this does not happen to the go.mod directly importing signalfx). This is likely due to the recent rebranding that cause smarty/smartystreets libs to rename their imports/modules. image

To replicate:

  1. import github.com/signalfx/golib/v3 in a go.mod and push to a remote repository (eg git push example-branch in a repo github.com/example-project).
  2. Import the branch in git repo via a separate go.mod (eg require github.com/example-project <example-branch> or require github.com/example-project + replace github.com/example-project => github.com/example-project <exampe-branch>)
  3. Run go mod tidy on new project

As stated above, running go mod tidy on the module directly seems to work. This seems to only happen if the dependency is 2 layers down or more. I suspect it might have something to with the way golang attempts to download dependencies and find tags for branches (this also happens for master if master is requiring signalfx/golib/v3 and you require as github.com/example-project master instead of the explicit tag). Also open to workarounds if anyone has any, but I propose a potential solution below:

Proposed Solution In go.mod, update goconvey to a later version to Also update smartystreets/assertions OR add replace directives to point this to smarty/assertions instead.

mehulparmariitr commented 5 months ago

what is the workaround for this?