Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bumping the version of Ginkgo gives go conflicting package error #1149

Closed
Ankitasw opened this issue Feb 24, 2023 · 24 comments
Closed

Bumping the version of Ginkgo gives go conflicting package error #1149

Ankitasw opened this issue Feb 24, 2023 · 24 comments

Comments

@Ankitasw
Copy link

Ankitasw commented Feb 24, 2023

We are currently using ginkgo version 2.8.1 in the Cluster API Provider for AWS project, but tried bumping the version to 2.8.3 and got the below error

"Running error: context loading failed: failed to load packages: failed to load with go/packages: internal error: go list gives conflicting information for package sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta2 [sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta2.test]"

Surprisingly this error comes only when we try to bump the version. Otherwise we never get this error in our codebase.
Refer this PR for more details.

I see no dependencies changed recently for ginkgo. Has anyone else come across this issue?
Or maybe it's a golang issue?

@Ankitasw
Copy link
Author

We are also getting similar error when bumping Gingko to v2.8.3 in Cluster API project. kubernetes-sigs/cluster-api#8143

@Ankitasw Ankitasw changed the title Bumping the version of Ginkgo gives error Bumping the version of Ginkgo gives go conflicting package error Feb 24, 2023
@onsi
Copy link
Owner

onsi commented Feb 24, 2023

hey @Ankitasw - can you try bumping to 2.8.2 to see if the same issue occurs? 2.8.2 introduced a tools.go file to force go to also fetch ginkgo's cli dependencies. 2.8.3 then bumped some other dependencies - i'd like to figure out which change is potentially causing this.

@Ankitasw
Copy link
Author

Thanks for the quick response @onsi
I tried with 2.8.2, and getting same error. We add ginkgo dependency in our own repo's tools.go but with this bump I even tried to remove it, but still getting the same error.

@onsi
Copy link
Owner

onsi commented Feb 24, 2023

weird ☹️ - my mental model for go modules is not very strong so i'm not sure why this is happening t. i can try to reproduce this over the weekend to debug it.

for now, some things to explore:

  • can you run go mod tidy after updating to 2.8.2 and remind ginkgo from your tools.go file? can you share the go.mod and go.sum before you bump to 2.8.2/fix tools and after?
  • is there more to the error you can share?
  • does go mod list show anything interesting?

@Ankitasw
Copy link
Author

Ankitasw commented Feb 24, 2023

weird ☹️ - my mental model for go modules is not very strong so i'm not sure why this is happening.

I understand, even I don't understand much around it.

i can try to reproduce this over the weekend to debug it.

Thankyou so much 🙇‍♀️

So there are two go.mod file in our repo. One is at the root project level, and another one at /hack/tools where tools.go recide.

can you run go mod tidy after updating to 2.8.2 and remind ginkgo from your tools.go file? can you share the go.mod and go.sum before you bump to 2.8.2/fix tools and after?

This is the root go.mod and go.sum files with v2.8.1. This is the go.mod and go.sum for tools.go.
This is the root go.mod and go.sum files with v2.8.2. This is the go.mod and go.sum for tools.go after removing ginkgo from tools.go.
I did run go mod tidy on both levels.

is there more to the error you can share?

There is no more to the error unfortunately 😞 but this error if thrown by golangci-lint only, and not while go build.

does go mod list show anything interesting?

Uhmm.. do you mean go list to check the deps? It gave this output from which I am not able to make out anything 😕 . Let me know if you suspect something there.

Please let me know if you need any other info.

@Skarlso
Copy link

Skarlso commented Feb 24, 2023

It's ginkgo's new way of being imported. It messed up the tools package chain. An "easy" fix is for golangci-lint not to lint tools. So remove the tools build tag.

@Skarlso
Copy link

Skarlso commented Feb 24, 2023

Oh, I see, I'm tired so I thought this is the cluster-api issue

Okay, so ginkgo folks, the move to tools magic broke the link chain in tools. Maybe it's okay, and we just remove the tools build tag from golangci-lint to not lint stuff. But since this is a breaking change in downward products, we would prefer it to happen in a major version instead of a patch version. :)

@onsi
Copy link
Owner

onsi commented Feb 24, 2023

is there anything i can do on my end to unbreak it? i'd sooner roll this back than bump to 3.0!

or to put it differently: do you understand (and can you explain) why this is breaking?

is it because i'm using a tools build tag? if i renamed it to something else (say... cheesecake) would this magically work?

@onsi
Copy link
Owner

onsi commented Feb 24, 2023

(which i'd be happy to do if you're up for bumping to a sha so we can see if it helps)

@onsi
Copy link
Owner

onsi commented Feb 25, 2023

in case y'all want to try this - i've dropped the tools build tag in favor of ginkgoclidependencies

this is on the latest sha:
a8bb39a

please give it at ry and let me know if it fixes this weird linter issue...

@Skarlso
Copy link

Skarlso commented Feb 25, 2023

Sorry @onsi it was super late so I went to bad. Most likely the break comes from a circular dependency appearing if both things use the same build tag somehow. I'm not a 100% sure yet why but I suspect it's a combination of things. It would be enough if you dropped it or used a different tag. Something like #ginkgo which is more specific to this library. However it's also a question if we should lint tools at all maybe.

I have to figure out some more approaches. Also I'm super thankful for your support! :)

@onsi
Copy link
Owner

onsi commented Feb 25, 2023

no worries and happy to help!

the latest commit sha uses ginkgoclidependencies instead of tools - if y'all can give it a try next week and confirm that it works i'll cut a new release

@Skarlso
Copy link

Skarlso commented Feb 25, 2023

Thanks, great! Will do that!

@Ankitasw
Copy link
Author

@onsi The changes works fine with above commit sha.
cc @Skarlso

@Skarlso
Copy link

Skarlso commented Feb 27, 2023

Fantastic! :)

@Ankitasw
Copy link
Author

Thanks for pointing in right direction @Skarlso 🙂

@Skarlso
Copy link

Skarlso commented Feb 27, 2023

My pleasure. 😊 and thanks @onsi for the rapid responses on this issue. 🙂

@Ankitasw
Copy link
Author

Ankitasw commented Feb 27, 2023

@onsi Thanks for the quick look at this issue, so could there be a possibility to make a new release with this change by this week?
I would close this issue post release.

@sbueringer
Copy link

Thx folks for investigating this issue!

@onsi
Copy link
Owner

onsi commented Feb 27, 2023

😮‍💨 glad that worked! should cut a release at some point today.

@onsi
Copy link
Owner

onsi commented Feb 27, 2023

2.8.4 is out now - please take a look and let me know if y'all are set :)

@Ankitasw
Copy link
Author

Thanks for being so proactive @onsi 🙂

@sbueringer
Copy link

Look good: kubernetes-sigs/cluster-api#8143

Thx for the quick fix!

@onsi
Copy link
Owner

onsi commented Feb 27, 2023

woot! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants