Skip to content

x/exp/cmd/gorelease: avoid using -mod=mod and support lazy module loading #41456

Closed
@jayconrod

Description

@jayconrod

gorelease uses go list $modpath/... to build a list of packages it needs to load and compare (where $modpath is the path of the module being released). Go 1.16 has -mod=readonly on by default (#40728), so if the module is missing one or more sums, this may result in an error like

go: updates to go.sum needed, disabled by -mod=readonly

We can work around this temporarily by explicitly using -mod=mod.

Go 1.16 will also support lazy module loading (#36460). This may require changes to the way gorelease generates temporary go.mod files for loading packages in downloaded modules, since nothing is imported in those temporary modules. We can work around this temporarily by using go 1.16 in temporary go.mod files.

A possible solution to both problems is to replace the go list call with a walk of the directory tree, listing non-main, non-internal packages (importable by other modules). Once we have such a list, we can generate a temporary .go file that imports those packages, then run go get -d on that temporary package. That will ensure it's safe to call packages.Load later.

cc @jadekler @bcmills

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.ToolsThis label describes issues relating to any tools in the x/tools repository.modules

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions