Format Go with gofmt, then golines -m 77 (#161)
check / check (push) Successful in 24s

This commit was merged in pull request #161.
This commit is contained in:
clawbot committed 2026-11-07 05:21:32 +01:00
1 parent 8c889fa622
commit d673785d33
5 files changed
+49 -14

No files matched your search

+23 -3
View File
@@ -1,6 +1,6 @@
---
title: Repository Policies
last_modified: 2026-11-06
last_modified: 2026-11-07
---
This document covers repository structure, tooling, and workflow standards. Code
@@ -675,11 +675,31 @@ style conventions are in separate documents:
- Use platform-standard formatters:
- `black` for Python
- `prettier` for JS/CSS/Markdown/HTML
- `go fmt` for Go
- `gofmt`, then `golines -m 77`, for Go
Always use default configuration, with two exceptions:
Always use default configuration, with three exceptions:
- four-space indents (except Go)
- `proseWrap: always` for Markdown (hard-wrap at 80 columns)
- a 77-column limit for Go, set by `golines -m 77`
`script/fmt` runs `gofmt` and then `golines -m 77` on Go code.
`script/fmt-check` fails when either of them would change a file. `golines`
comes from `github.com/segmentio/golines`. `script/bootstrap` installs it
with `go install`, pinned to a commit hash as below:
```sh
# golines v0.13.0, 2025-08-21
go install github.com/segmentio/golines@8f32f0f7e89c30f572c7f2cd3b2a48016b9d8bbf
```
`script/bootstrap` reads the installed version from the `mod` line of
`go version -m "$(command -v golines)"`, which reports `v0.13.0`. It does
not use `golines --version`, which prints `golines vdev` for a binary that
`go install` built.
`golines` cannot shorten every line: long string literals and comments stay
as they are. golangci-lint's `lll` limit therefore stays at 88 columns, so
it fails only lines far past the formatter's limit.
Documentation and writing repos (Markdown, HTML, CSS) should also have
`.prettierrc` and `.prettierignore`.