Help us shape the future of Go! Take the 2026 Go Developer Survey

crlfmt

command module
v0.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2026 License: Apache-2.0 Imports: 16 Imported by: 1

README

crlfmt

crlfmt is a gofmt-style linter for Go code that enforces the CockroachDB Style Guide found here.

Usage

$ go install github.com/cockroachdb/crlfmt
$ crlfmt [flags] <file path>

Flags:
  -diff             print diffs (default true)
  -fast             skip running goimports and simplify
  -groupimports     group imports by type (default true)
  -ignore <string>  regex matching files to skip
  -tab <int>        tab width for column calculations (default 2)
  -w                overwrite modified files
  -wrap <int>       column to wrap at (default 100)
  -wrapdoc <int>    column at which to wrap doc strings for functions, variables, constants, and types. ignores multiline comments denoted by /*

Examples

If you are running crlfmt on the http://github.com/cockroachdb/cockroach codebase, you can use the following command to reformat all files in the current directory, ignoring generated code files:

$ crlfmt -w -ignore '\.(pb(\.gw)?)|(\.[eo]g)\.go|/testdata/|^sql/parser/sql\.go$|_generated(_test)?\.go$' .

Documentation

Overview

Command crlfmt formats Go source code according to CockroachDB's style, wrapping long function signatures and grouping imports.

Directories

Path Synopsis
internal
parser
Package parser parses Go files into an AST that can be easily formatted.
Package parser parses Go files into an AST that can be easily formatted.
render
Package render turns parsed Go declarations back into formatted source, wrapping function signatures and grouping imports per crlfmt's style.
Package render turns parsed Go declarations back into formatted source, wrapping function signatures and grouping imports per crlfmt's style.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL