go icon indicating copy to clipboard operation
go copied to clipboard

x/tools/cmd/ssadump: needs to set packages.NeedModule flag

Open dominikh opened this issue 1 year ago • 1 comments

ssadump doesn't set NeedModule, which causes go/types.Config.GoVersion to not be set, which means go/ssa won't respect the Go version set in go.mod, which is relevant for the scope of range loop variables.

Related: https://github.com/golang/go/issues/48226#issuecomment-1954523281

/cc @adonovan @timothy-king

dominikh avatar May 16 '24 16:05 dominikh

@timothy-king Presumably this is an issue for all our tools that use either go/types or go/ssa: they all need to set NeedModules in order that they process source files using the module's appropriate language version.

If so, this seems to warrant a more general fix than just to cmd/ssadump.

adonovan avatar May 16 '24 16:05 adonovan

Change https://go.dev/cl/597875 mentions this issue: go/packages: NeedTypes implies NeedModule

gopherbot avatar Jul 11 '24 22:07 gopherbot