x/playground: if Imports is checked, run 'go mod tidy' when the Format button is pressed
#32,614 opened on Jun 14, 2019
Repository metrics
- Stars
- (133,883 stars)
- PR merge metrics
- (No merged PRs in 30d)
Description
CL 177421 added formatting for go.mod files in the Playground.
However, that isn't really enough to result in a reproducible build: as noted in https://github.com/golang/go/issues/31944#issuecomment-501527897, unresolved dependencies are re-resolved whenever the cache is invalidated, which is difficult to predict.
One simple fix to add stability would be to have the existing Imports checkbox trigger a go mod tidy after running goimports. That would make the versions in use much clearer in the code and more stable over time, without the need for humans to manually resolve and copy over their go.mod files.
CC @dmitshur @ysmolsky