x/tools/internal/inline: remove dependency on the Go command #71406
Labels
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
The x/tools source code inliner invokes the Go command indirectly, when it runs goimports logic to compute import edits:
https://cs.opensource.google/go/x/tools/+/master:internal/refactor/inline/inline.go;l=403;drc=39017333097c18f58aa50f00bcd4ce01983ea305
Since the inliner is used in the analysis framework, this is really a violation of boundaries, and causes practical problems when analysis drivers do not have access to the go command for the current environment.
There's also no good reason for this dependency, except that the way goimports is currently factored couples the resolution of imports with the computation of fixes. CC @pjweinb who has also run into this problem while wiring in the modcache index to goimports.
In the short term, we need to remove this dependency from the inliner--even if it means duplicating some logic from goimports.
CC @adonovan @lfolger
The text was updated successfully, but these errors were encountered: