Command-line tool
goimports
brew/goimports
Checked 25 Oct 2026, 21:09 UTC · Listing refreshed from Homebrew, winget, npm, Scoop and cargo; npm packages checked against OSV.dev
Go formatter that additionally inserts import statements
At a glance
- Type
- Command-line tool
- Install on
- macOS, Linux
- Last checked
- 25 Oct 2026, 21:09 UTC
Install it
macOS
brew install goimports
Linux
brew install goimports
Display the completed import source file
goimports path/to/file.go
Write the result back to the source file instead of `stdout`
goimports -w path/to/file.go
Display diffs and write the result back to the source file
goimports -w -d path/to/file.go
Related command-line tools
- sql-formatter
Whitespace formatter for different query languages - gdscript-formatter
A fast code formatter for GDScript in Godot 4. - rsql_formatters
rsql formatters to output rsql results in various formats - kdoc-formatter
Reformats Kotlin KDoc comments, reflowing text and other cleanup - gersemi
Formatter to make your CMake code the real treasure formatter cmake cmake-format cmake-language cmakelists… - air
Fast and opinionated formatter for R code r language-server lsp formatter rstats - ktfmt
Kotlin code formatter - dfmt
Formatter for D source code
Listing text is written by the maker; AptLynx lists tools and does not vouch for them. Find another tool · Browse by topic · For agents