golang/go

x/playground: if Imports is checked, run 'go mod tidy' when the Format button is pressed

Open

#32,614 建立於 2019年6月14日

在 GitHub 查看
 (3 留言) (0 反應) (0 負責人)Go (19,008 fork)batch import
FeatureRequestNeedsInvestigationhelp wantedmodules

倉庫指標

Star
 (133,883 star)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

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

貢獻者指南