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: add a go work sync command #48258

Open
matloob opened this issue Sep 8, 2021 · 5 comments
Open

cmd/go: add a go work sync command #48258

matloob opened this issue Sep 8, 2021 · 5 comments

Comments

@matloob
Copy link
Contributor

@matloob matloob commented Sep 8, 2021

This issue proposes amending the Workspaces Proposal (#45713) to add a new go mod syncwork command.

go mod syncwork would compute the buildlist from the workspace modules, and then sync it back to the workspace module go.mod files, setting the versions of any non-workspace modules to the versions in the build list (perhaps also tidying the files afterward). This ensures that the workspace modules use the same set of non-workspace dependencies when they're built outside the workspace.

A version of this was suggested by @jayconrod on an issue comment on the Workspaces proposal.

cc @bcmills @ianthehat

@gopherbot gopherbot added this to the Proposal milestone Sep 8, 2021
@seankhliao seankhliao changed the title Proposal: cmd/go: add a go mod syncwork command proposal: cmd/go: add a go mod syncwork command Sep 8, 2021
@ianlancetaylor ianlancetaylor added this to Incoming in Proposals Sep 15, 2021
@rsc
Copy link
Contributor

@rsc rsc commented Oct 6, 2021

This proposal has been added to the active column of the proposals project
and will now be reviewed at the weekly proposal review meetings.
— rsc for the proposal review group

@rsc rsc moved this from Incoming to Active in Proposals Oct 6, 2021
@rsc
Copy link
Contributor

@rsc rsc commented Oct 13, 2021

Based on the discussion above, this proposal seems like a likely accept.
— rsc for the proposal review group

@rsc rsc moved this from Active to Likely Accept in Proposals Oct 13, 2021
@mvdan
Copy link
Member

@mvdan mvdan commented Oct 13, 2021

With my module author hat on, I definitely agree that this is a problem in need of solving - if one is developing and testing on a workspace, one can easily forget to check if each module individually still works as expected, without the workspace context.

I have a slight feeling that this feature is backwards, though. For example, right now I was using a go.work file to develop three libraries at once. When I'm done with my change, I want to make sure that each library still works as expected without go.work, and bump some dependencies for each module otherwise.

I don't think I would want to use go mod syncwork for this use case, because that feels like a very big hammer. For a library, I think it's generally saner to only update dependencies as needed. If I have libraries A and B, and A pulls a version of dependency C that's much newer than the version of C that B requires, I probably wouldn't want users of B to be forced into using the newest C unless B actually requires that - be it for a feature, or for a necessary bugfix.

I'm not sure what I would want to use instead, in terms of automation. Presumably, the right way of double checking that the library modules still work outside the workspace is a manual process. Maybe that checking, without editing any go.mod files, could be automated in cmd/go.

@hherman1
Copy link

@hherman1 hherman1 commented Oct 13, 2021

Nit: given https://golang.org/issue/48256 shouldn’t this be go work sync?

@rsc rsc changed the title proposal: cmd/go: add a go mod syncwork command proposal: cmd/go: add a go work sync command Oct 20, 2021
@rsc rsc moved this from Likely Accept to Accepted in Proposals Oct 20, 2021
@rsc
Copy link
Contributor

@rsc rsc commented Oct 20, 2021

No change in consensus, so accepted. 🎉
This issue now tracks the work of implementing the proposal.
— rsc for the proposal review group

@rsc rsc changed the title proposal: cmd/go: add a go work sync command cmd/go: add a go work sync command Oct 20, 2021
@rsc rsc removed this from the Proposal milestone Oct 20, 2021
@rsc rsc added this to the Backlog milestone Oct 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Proposals
Accepted
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants