Skip to content

proposal: cmd/go: add '// test' after mod like '// indirect' in go.mod #63752

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

Closed
ftcopilot106 opened this issue Oct 26, 2023 · 1 comment
Closed

Comments

@ftcopilot106
Copy link

now go mod tidy command will write go.mod like this, if I import github.com/package/a and a import github.com/package/b, and b import github.com/package/c

module package_name

go 1.21.3

require (
	github.com/package/a v1.0.0 
)


require (
	github.com/package/b v1.0.0 // indirect
	github.com/package/c v1.0.0 // indirect
)

and then I import github.com/package/b by my test code, then run go mod tidy, go.mod file will like this

module package_name

go 1.21.3

require (
	github.com/package/a v1.0.0 
	github.com/package/b v1.0.0 
)

require (
	github.com/package/c v1.0.0 // indirect
)

github.com/package/b will move, but not mark it is test import

so I hope go.mod like this

module package_name

go 1.21.3

require (
	github.com/package/a v1.0.0 
)


require (
	github.com/package/b v1.0.0 // test
)

require (
	github.com/package/c v1.0.0 // indirect
)

it will show me packages I import just in test, and not need run go mod why -m ...

@gopherbot gopherbot added this to the Proposal milestone Oct 26, 2023
@mvdan
Copy link
Member

mvdan commented Oct 26, 2023

Very closely related to #26913, #42766, and #26955 - I don't think more open issues on this are helpful. See the last one I linked, which is still open.

@mvdan mvdan closed this as not planned Won't fix, can't repro, duplicate, stale Oct 26, 2023
@golang golang locked and limited conversation to collaborators Oct 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants