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: remove legacy conversions #53327

Closed
rsc opened this issue Jun 10, 2022 · 9 comments
Closed

cmd/go: remove legacy conversions #53327

rsc opened this issue Jun 10, 2022 · 9 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 Jun 10, 2022

The go command contains code to automatically populate go.mod during 'go mod init' using the metadata from various now very old, outdated Go dependency managers. The code is complex, so it needed a good test (testdata/script/mod_convert.txt), which fetches very old versions of various actual packages.

The code has little benefit today, as it can only possibly work on ancient programs, and everyone who was going to update to Go modules has done so at this point. At the same time, the test is now one of the longest tests in cmd/go. We pay a high cost for this code that no one needs anymore.

Let's just delete the code and the test.

@rsc rsc added this to the Go1.20 milestone Jun 10, 2022
@rsc
Copy link
Contributor Author

rsc commented Jun 10, 2022

/cc @bcmills @matloob

@rsc rsc self-assigned this Jun 10, 2022
@rsc rsc added the NeedsFix The path to resolution is known, but the work has not been done. label Jun 10, 2022
@seankhliao seankhliao added the GoCommand cmd/go label Jun 10, 2022
@oiooj
Copy link
Member

oiooj commented Jun 12, 2022

Since I am also involved in the development of mod conversions, I‘d like to do this work.

@mvdan
Copy link
Member

mvdan commented Jun 12, 2022

Should we somehow point users trying to convert to modules to the latest Go version that still supported that automation in go mod init? It would likely still be better than doing it by hand for some time.

@bcmills
Copy link
Contributor

bcmills commented Jun 17, 2022

Not to mention, the conversion code had some bugs and never really worked properly to begin with (see #33406, perhaps others). 😅

@earthboundkid
Copy link
Contributor

May I suggest extracting the code from the go tool and dumping it into some repo where it can be independently installed?

A party trick I sometimes do is take a small project that I wrote in 2018 and show that it can be upgraded to the current version of Go in less than a minute, while the JavaScript dependencies in the project basically can't be installed at all, let alone upgraded. I would hate for my trick to stop working. :-) More seriously, it would be nice to leave some liferaft for anyone who finds themselves handed an important but abandoned bit of Go software for their organization.

@bcmills
Copy link
Contributor

bcmills commented Sep 9, 2022

@carlmjohnson, there are enough differences between modules and the legacy dependency-management tools that a straight conversion often isn't valid anyway (due to unsupported pinning behaviors, or module dependencies that were not seen by the legacy tools, or differences in module vs. package or repo granularity).

Generally, go mod tidy -e should give a good enough rough cut, and go get can be used to fine-tune it from there.

@rsc
Copy link
Contributor Author

rsc commented Sep 12, 2022

@carlmjohnson Does your program use dep or godeps or one of those? If not, you won't be affected. If so, try deleting the config file from that versioning tool and see how well the go command fares. My guess is the config is not doing much. If I'm wrong, that'd be good to know.

@earthboundkid
Copy link
Contributor

It used dep. If you delete the Gopkg.toml and lock files, it doesn't quite build because of a breaking change in go-chi, but that's the only thing holding it back. The import paths are otherwise enough for a build.

@gopherbot
Copy link

Change https://go.dev/cl/548877 mentions this issue: doc,cmd/go: document that 'go mod init' no longer imports from other vendoring tools

ezz-no pushed a commit to ezz-no/go-ezzno that referenced this issue Feb 18, 2024
… other vendoring tools

This support was removed in CL 518776.

For golang#61422.
Fixes golang#53327.

Change-Id: I8ad0f76aed5f03e32c4c2c5c0001c3f06beb3c7d
Reviewed-on: https://go-review.googlesource.com/c/go/+/548877
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
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

7 participants