Recommended Free Tools
Use goimports-reviser to organize Go imports into configurable groups and, when requested, format the code in the same run. Its documented options also cover unused-import removal, package aliases, recursive processing, and generated files. Unlike goimports, which can insert imports required by edited code, goimports-reviser is presented primarily as a configurable import sorter.
What goimports-reviser does
goimports-reviser sorts imports into groups: standard-library packages, general-purpose packages, optional company packages, and project dependencies. The documented default order is standard library, general-purpose, company, then project imports. Company packages can be identified using configured company prefixes.
Formatting is optional. Add -format when you want the tool to format the code as well as revise its imports. The README calls the utility a goimports alternative, but its emphasis is configurable import grouping rather than automatic insertion of newly required imports.
Install the tool
The project README documents these installation routes. Package availability and release details can change, so check the current project page before relying on a particular package manager.
#1 Best Overall
Install with Go
go install -v github.com/incu6us/goimports-reviser/v3@latest
Install with Homebrew
brew tap incu6us/homebrew-tap
brew install incu6us/homebrew-tap/goimports-reviser
Install with Snap
snap install goimports-reviser
Run it on a file, directory, or package pattern
The README demonstrates combining options to remove unused imports, set package aliases, and format code. Replace the example target with the Go file, directory, or package pattern you want to process.
Process a file
goimports-reviser -rm-unused -set-alias -format path/to/file.go
Process a directory recursively
goimports-reviser -rm-unused -set-alias -format -recursive path/to/directory
Process packages matching a pattern
goimports-reviser -rm-unused -set-alias -format ./...
These examples use options documented by the project; confirm exact argument behavior and accepted target forms in the README for the version you install.
Configure import grouping
Use -imports-order to customize group ordering. Use -company-prefixes to classify organizational imports as company packages. That classification matters when you want company dependencies kept separate from both general-purpose packages and project imports.
The default grouping described by the README is:
- Standard library
- General-purpose packages
- Company packages, when configured
- Project dependencies
Without company grouping configured, the tool describes imports in three groups rather than four.
Options worth knowing
| Option | Documented purpose |
|---|---|
-rm-unused |
Remove unused imports. |
-set-alias |
Set package aliases. |
-format |
Format code. |
-recursive |
Process directories recursively. |
-imports-order |
Customize import group ordering. |
-company-prefixes |
Classify organizational package prefixes as company imports. |
-list-diff |
List differences. |
-set-exit-status |
Set the command’s exit status according to its documented behavior. |
-use-cache |
Enable cache use. |
-apply-to-generated-files |
Include generated files in processing. |
For the precise syntax and effects of flags, use the project README and the Go package documentation for v3.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.goimports-reviser vs. goimports
The distinction is what each tool’s documentation highlights. The Go tools repository describes goimports as formatting a Go program like go fmt while also inserting imports required by the edited file. The goimports-reviser README emphasizes sorting imports into configurable groups, with optional formatting.
Rank #4
Choose based on the task: goimports is documented to add imports needed by edited code; goimports-reviser is useful when you want control over how existing imports are grouped, with additional cleanup and formatting options. The cited documentation provides no benchmark or empirical comparison of speed, correctness, or editor integration, so it does not establish that one is generally better.
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.

