Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>Go Imports SorterNew to Visual Studio Code? Get it now.
Go Imports Sorter

Go Imports Sorter

Saxon Chuang

|
7 installs
| (1) | Free
VSCode extension for separating imports in go files into groups: standard, 3rd party, same domain, current project.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

go-imports-sorter

VSCode extension for separating imports in Go files into following groups:

  1. Standard library imports
  2. Third party imports
  3. Own library (belonging to the organization) imports.
  4. Self imports (import current project packages).

Extension Settings

  • groupImports.onSave: automatically group imports on save. Default value is true.

Modernization & Refactor (v1.2.0)

This extension has undergone a complete architectural refactor to improve performance, stability, and maintainability.

Key Improvements

  • Performance: Integrated esbuild for optimized extension bundling, resulting in faster startup and smaller package size.
  • Architecture: Complete rewrite in TypeScript 5.0 with strict type safety and SOLID principles.
  • Testing: New unit testing architecture running 99% faster (checking domain logic without needing a VS Code instance).
  • Reliability: Decoupled file system logic for more robust path handling across different OS environments.

Development

This project uses modern tooling for development:

  • Build: npm run esbuild (Bundles the extension)
  • Watch: npm run esbuild-watch (Rebuilds on change)
  • Test: npm test (Runs unit tests via Mocha)
  • Lint: npm run lint

Notes

  • This repo is fork from beerose/go-group-imports-vscode.
  • You can find and install this extension on marketplace

Recent Updates

  • Parsing: Added robust parser for single-line imports (import "fmt") and comment preservation.
  • Resolution: Enhanced project root detection with recursive go.mod search and go env GOPATH fallback.
  • Safety: Added timeout protection for onWillSave to prevent editor blocking.
  • Refactor: Implemented Clean Architecture (Domain/Service/Controller separation).
  • Build: Added esbuild integration for production-grade bundling.
  • Core: Rewrote ImportProcessor and GoProjectService for better testability.
  • Cleanup: Removed legacy dependencies and improved code quality.
  • Fix: Resolved issue where import groups lacked a trailing newline, causing formatting errors.
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft