Skip to content
SPECIFICTION
Get listed

Black vs goimports

Black

black.readthedocs.io

goimports

pkg.go.dev

Side by side

FigureBlackgoimports
Price fromFreeFree
Free planYesYes
Free trial——
Open source——
Web—Yes
WindowsYesYes
macOSYesYes
LinuxYesYes
Self-hostedYes—
Plans published11
Spec score · Code Formatting Tools8.7 (#1)7.7 (#17)
Editor integrationsThe documentation describes integrations for editors including PyCharm, Vim, Neovim, Visual Studio Code, and Sublime Text.The documentation describes using goimports with Emacs, Vim, and GoSublime, and says it can be configured for other editors.
FormattingBlack reformats whole files in place and uses a default line length of 88 characters.It formats code in the same style as gofmt and can replace an editor’s gofmt-on-save hook.
InstallationBlack installs with pip or pipx and requires Python 3.10 or later to run.The package page gives `go install golang.org/x/tools/cmd/goimports@latest` as the installation command.
LicenseBlack is licensed under the MIT license.The package page identifies its license as BSD-3-Clause and marks it redistributable.
PurposeBlack is an opinionated formatter for Python code that follows PEP 8.goimports updates Go import lines by adding missing imports and removing unreferenced imports.

Plans

Black

  • BlackFree

Black pricing →

goimports

  • FreeFree

goimports pricing →

In their own words

Black

Black is a free, MIT-licensed formatter for Python code that follows PEP 8. It reformats whole files in place and uses a default line length of 88 characters. Its limited style choices are intended to keep code consistent across projects; indentation style cannot be configured. After formatting, Black checks whether the abstract syntax tree remains effectively equivalent and raises an error if the check fails. Install it with pip; it requires Python 3.10 or newer. The documentation lists editor integrations including Emacs, PyCharm, IntelliJ IDEA, Vim, Neovim, Visual Studio Code and Sublime Text, as well as GitHub Actions and doctest workflows. Notebook formatting is available with the jupyter extra, though Black skips cells containing certain magics or invalid syntax. It also includes blackd, an HTTP server that binds to localhost by default. Black is primarily a command-line tool and does not provide a Python interface. Stable releases preserve formatting within the same calendar year when the options match.

Visit black.readthedocs.io

goimports

goimports has no write-up on Specifiction yet; its figures are above.

Visit pkg.go.dev