In CLs 253799 and 254756, @heschik switched to explicitly using -mod=mod to preserve the current behavior of gopls with Go 1.16. Since -mod=mod will be deprecated, we need an alternative approach for the future.
A proposed solution has been to run go mod tidy before gopls runs go/packages.Load. This can be done with -modfile or in the temporary workspace module. This way, we preserve the existing behavior that allows users to edit modules that don't compile, but we still offer go mod tidy diagnostics. These diagnostics should be upgraded to errors (with Go 1.16).
This isn't strictly necessary, but we've broken it a number of times,
and it's easier to have a regtest for it. When golang/go#41437 is resolved, we
might consider making this a -mod=mod test or something.
Also, added a wrapper for RunGoCommand.
Reviewed-by: Heschi Kreinick <firstname.lastname@example.org>
Run-TryBot: Rebecca Stambler <email@example.com>
gopls-CI: kokoro <firstname.lastname@example.org>
TryBot-Result: Go Bot <email@example.com>
Trust: Rebecca Stambler <firstname.lastname@example.org>