Skip to content
SPECIFICTION
Get listed

gofmt vs rustfmt

gofmt

go.dev

rustfmt

rust-lang.github.io

Side by side

Figuregofmtrustfmt
Price fromFreeFree
Free planYesYes
Free trial——
Open source——
WindowsYesYes
macOSYesYes
LinuxYesYes
Plans published11
Spec score · Code Formatting Tools7.8 (#13)8.0 (#10)
Editor integrationsThe Go project documents gofmt integrations for Vim, Emacs, Eclipse, Sublime Text, Git pre-commit hooks, and Mercurial.The README lists integrations or usage instructions for Vim, Emacs, Sublime Text 3, Atom, Visual Studio Code, and IntelliJ or CLion.
LicenseGo is an open source project distributed under a BSD-style license.rustfmt is distributed under both the MIT License and Apache License 2.0.
PurposeGofmt automatically formats Go programs using tabs for indentation and blanks for alignment.rustfmt formats Rust code according to style guidelines.
SupportQuestions about using Go or announcements relevant to Go users should be sent to the golang-nuts mailing list.The README points users to `rustfmt --help` and `cargo fmt --help` for command usage and arguments.

Plans

gofmt

  • gofmtFree

gofmt pricing →

rustfmt

  • rustfmtFree

rustfmt pricing →

In their own words

gofmt

gofmt is the Go source formatter distributed with Go installations, available on Linux, macOS, and Windows. It formats Go programs using tabs for indentation and spaces for alignment. With no path, it reads standard input; given a directory, it processes .go files recursively while skipping files whose names begin with a period. By default, reformatted source is written to standard output. Flags can show differences, list files that need formatting, apply rewrite rules, simplify code, or report all errors. The rewrite option uses patterns and replacements written as valid Go expressions. gofmt can also arrange documentation comments into canonical paragraphs, lists, headings, links, and code blocks. The Go project documents integrations for Vim, Emacs, Eclipse, and Sublime Text, plus Git pre-commit hooks and Mercurial. Since Go 1.18, it reads and formats files concurrently, with memory use limited in proportion to GOMAXPROCS. The executable is equivalent to go fmt. It is free, included in the Go installation, and distributed under a BSD-style license.

Visit go.dev

rustfmt

rustfmt formats Rust code according to style guidelines. It can format files directly or read code from standard input and write formatted output to standard output. With Cargo, `cargo fmt` formats binary and library targets in a crate and works with workspaces. A `rustfmt.toml` or `.rustfmt.toml` file can hold configuration, including stable and nightly-only options. For automated checks, `--check` returns code 0 when no formatting changes are needed and code 1 when changes would be made; it can be used in CI to fail a build on formatting differences. The README lists editor use with Vim, Emacs, Sublime Text 3, Atom, Visual Studio Code, IntelliJ, and CLion. Rustfmt is available on Windows, macOS, and Linux, and is distributed under the MIT License and Apache License 2.0. It does not attempt to format comments, and listed limitations also involve macros, unparsable code, fragments, and non-ASCII Unicode. Unstable settings require opt-in on nightly, and the README says the latest version requires the nightly toolchain.

Visit rust-lang.github.io