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

cmd/go: "import cycle not allowed in test" message shows wrong stack #59970

Closed
rsc opened this issue May 4, 2023 · 6 comments
Closed

cmd/go: "import cycle not allowed in test" message shows wrong stack #59970

rsc opened this issue May 4, 2023 · 6 comments
Assignees
Labels
GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@rsc
Copy link
Contributor

rsc commented May 4, 2023

% cd go/src/internal/godebug
% echo 'package godebug; import _ "testing"' >g_test.go
% go test
# internal/godebug
package internal/godebug
	imports math/rand
	imports testing: import cycle not allowed in test
FAIL	internal/godebug [setup failed]
% 

The error is incorrect (the imports it reports are reversed from reality) and incomplete (it doesn't complete the cycle). It should say something like:

package internal/godebug
	imports testing
	imports math/rand
	imports internal/godebug: import cycle not allowed in test
FAIL	internal/godebug [setup failed]
@rsc rsc added the NeedsFix The path to resolution is known, but the work has not been done. label May 4, 2023
@rsc rsc added this to the Go1.21 milestone May 4, 2023
@bcmills bcmills added the GoCommand cmd/go label May 4, 2023
@bcmills bcmills assigned bcmills and unassigned bcmills May 5, 2023
@giridharan-7
Copy link

Hey, can i work on this issue? if you don't mind :)

@bcmills
Copy link
Contributor

bcmills commented May 15, 2023

Sure, but it needs to happen very soon. 😅

@giridharan-7
Copy link

ouch!.. I'll try my best but, I am new to opensource and have really some good understanding of the Golang.. for the past 20 days i finding the some good issue to getting start my contribution journey but i didn't find that yet.. If there is any some good beginner friendly issues.. Please suggest me :) have a nice day!!!

@saurabhsuniljain
Copy link

@giridharan-7 Are you still working on this ?

@gopherbot
Copy link

Change https://go.dev/cl/498115 mentions this issue: cmd/go: fix reporting of test cycles to have proper order

@bcmills
Copy link
Contributor

bcmills commented May 25, 2023

@matloob has a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

6 participants