The Wire ยท Showcase
GOIMPORTS JUST GOT 3X FASTER
By RepoJournal ยท Filed ยท About Go
golang/tools cut goimports execution time from seconds to subseconds by leveraging the module cache index that gopls already builds.
The golang/tools team shipped an optimization that fundamentally changes how goimports scans dependencies [1]. Instead of brute-forcing the entire module cache on every invocation, the new code checks for an index first, the same one gopls creates during normal editing sessions. If that index exists, goimports uses it. If not, it falls back to the original behavior. The impact is measurable: on a standard laptop, execution drops to 0.66 seconds [1]. This is the kind of invisible performance win that compounds across a thousand editor saves in a workday. The implementation is clean - no test refactoring required because the existing test suite doesn't generate indexes, so nothing breaks.
Action items
- โ Update golang/tools to get the goimports speedup in your next gopls sync golang/tools [plan]
References
- [1] internal/imports: use module cache index if it exists golang/tools
FAQ
- What changed in Go on June 28, 2026?
- golang/tools cut goimports execution time from seconds to subseconds by leveraging the module cache index that gopls already builds.
- What should Go teams do about it?
- Update golang/tools to get the goimports speedup in your next gopls sync
- Which Go repositories shipped on June 28, 2026?
- golang/tools