gofmt
Input—per 1M tokens
Output—per 1M tokens
Context—tokens
WeightsClosed
About
gofmt is ranked #9 of 34 in code formatting tools on Inferse. It runs on Linux, macOS, Windows. There is a free plan.
Compared on code formatting tools
Facts
- Purpose
- Gofmt automatically formats Go programs using tabs for indentation and blanks for alignment.go.dev · 1 Oct 2026
- Input handling
- Without an explicit path, gofmt processes standard input; with a directory, it recursively processes .go files while ignoring files beginning with a period.go.dev · 1 Oct 2026
- Output
- By default, gofmt prints reformatted sources to standard output.go.dev · 1 Oct 2026
- Formatting options
- Its flags include displaying diffs, listing files with formatting differences, applying rewrite rules, simplifying code, and reporting all errors.go.dev · 1 Oct 2026
- Comment formatting
- Gofmt reformats Go documentation comments into canonical paragraphs, lists, headings, links, and code blocks.go.dev · 1 Oct 2026
- Source transformation
- The -r flag applies rewrite rules whose patterns and replacements are valid Go expressions.go.dev · 1 Oct 2026
- Editor integrations
- The Go project documents gofmt integrations for Vim, Emacs, Eclipse, Sublime Text, Git pre-commit hooks, and Mercurial.go.dev · 1 Oct 2026
- Performance
- Since Go 1.18, gofmt reads and formats input files concurrently with memory limited proportionally to GOMAXPROCS.go.dev · 1 Oct 2026
- Distribution
- The Go installation process installs an executable called gofmt, equivalent to go fmt.go.dev · 1 Oct 2026
- Platforms
- The Go compiler toolchain can target AIX, Android, DragonFly BSD, FreeBSD, Illumos, Linux, macOS/iOS, NetBSD, OpenBSD, Plan 9, Solaris, and Windows.go.dev · 1 Oct 2026
- License
- Go is an open source project distributed under a BSD-style license.go.dev · 1 Oct 2026
- Security
- The Go project issues security fixes to the two most recent major Go releases and provides a security policy for reporting vulnerabilities.go.dev · 1 Oct 2026
- Support
- Questions about using Go or announcements relevant to Go users should be sent to the golang-nuts mailing list.go.dev · 1 Oct 2026
Best gofmt alternatives
See all 12
7.3 Taplo Free free plan, no paid price published Free plan
7.2 pgFormatter Free free plan, no paid price published Free plan
7.2 Prettier Free free plan, no paid price published Free plan
6.9 autopep8 See plans price on the maker's page
6.0 Black Free free plan, no paid price published Free plan
6.0 rustfmt Free free plan, no paid price published Free plan Where it ranks on Inferse
Sources
- go.dev/cmd/gofmt/· checked 1 Oct 2026
- go.dev/doc/comment· checked 1 Oct 2026
- go.dev/blog/gofmt· checked 1 Oct 2026
- go.dev/doc/go1.18· checked 1 Oct 2026
- go.dev/doc/cmd· checked 1 Oct 2026
- go.dev/doc/install/source· checked 1 Oct 2026
- go.dev/project· checked 1 Oct 2026
- go.dev/doc/security/· checked 1 Oct 2026
