cc @adonovan @seankhliao @golang/go-command
The -modfile flag was added to allow tools such as gopls to run the go command logic to make changes to a temporary version of a go.mod file so that those changes could be surfaced to the user and applied in the editor. But the flag is complicated to support and has overlap with overlays.
Ideally commands that modify go.mod (without -mod=mod being provided) (go mod tidy and go get) can output the file contents in a special mode for tools to use instead, and we could remove the -modfile flag.
If we can't remove it, I think we should restrict it to only the subcommands that need to be used by gopls to reduce the complexity we'd have to support in the go command.
cc @adonovan @seankhliao @golang/go-command
The
-modfileflag was added to allow tools such asgoplsto run the go command logic to make changes to a temporary version of ago.modfile so that those changes could be surfaced to the user and applied in the editor. But the flag is complicated to support and has overlap with overlays.Ideally commands that modify go.mod (without -mod=mod being provided) (
go mod tidyandgo get) can output the file contents in a special mode for tools to use instead, and we could remove the-modfileflag.If we can't remove it, I think we should restrict it to only the subcommands that need to be used by
goplsto reduce the complexity we'd have to support in the go command.