https://github.com/cockroachdb/crlfmt
Formatter for CockroachDB's additions to the Go style guide.
https://github.com/cockroachdb/crlfmt
Last synced: 9 days ago
JSON representation
Formatter for CockroachDB's additions to the Go style guide.
- Host: GitHub
- URL: https://github.com/cockroachdb/crlfmt
- Owner: cockroachdb
- License: apache-2.0
- Created: 2016-08-24T16:09:50.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2024-08-07T00:49:04.000Z (11 months ago)
- Last Synced: 2025-06-13T14:02:31.261Z (13 days ago)
- Language: Go
- Homepage:
- Size: 113 KB
- Stars: 18
- Watchers: 51
- Forks: 14
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# crlfmt
`crlfmt` is a `gofmt`-style linter for Go code that enforces the CockroachDB Style Guide found [here](https://wiki.crdb.io/wiki/spaces/CRDB/pages/181371303/Go+coding+guidelines).
## Usage
```
$ go install github.com/cockroachdb/crlfmt
$ crlfmt [flags]Flags:
-diff print diffs (default true)
-fast skip running goimports and simplify
-groupimports group imports by type (default true)
-ignore regex matching files to skip
-tab tab width for column calculations (default 2)
-w overwrite modified files
-wrap column to wrap at (default 100)
-wrapdoc 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$' .
```