indent_style
Every non-blank line indents with the configured style (tabs or spaces). When style: spaces, optional width enforces a multiple.
Check-only: tab-width-aware reindentation is language-specific. Pair with your editor’s “reindent on save” for remediation.
Options
Section titled “Options”| Option | Type | Required | Default | Description |
|---|---|---|---|---|
style | one of tabs | spaces | yes | Required indentation style: tabs rejects any leading space; spaces rejects any leading tab. | |
width | integer (>= 1) | null | When style: spaces, the leading-space count on every non-blank line must be a multiple of this. Ignored for style: tabs. |
Plus the common paths, level, id, and when fields. This table is generated from the JSON Schema; option types and defaults are authoritative.
Example
Section titled “Example”A Go file indented with spaces instead of tabs
Section titled “A Go file indented with spaces instead of tabs”The rule fires on this repository:
src/src/bad.gosrc/ok.gopackage main
func y() { return}package main
func x() { return}With this .alint.yml:
version: 1rules: - id: go-tabs kind: indent_style paths: "src/**/*.go" style: tabs level: erroralint check reports:
--- src/bad.go ----------------------------------------------------------------- x error go-tabs 4:1 line 4 indented with the wrong character (expected tabs)
Summary (1 violation): x 1 error 0 passing * 1 failingEvery Go file is indented with tabs
Section titled “Every Go file is indented with tabs”This repository is compliant:
src/src/a.gosrc/b.gopackage main
func x() { return}package main
func y() { if true { return }}With this .alint.yml:
version: 1rules: - id: go-tabs kind: indent_style paths: "src/**/*.go" style: tabs level: erroralint check reports:
v All 1 rule(s) passed.