mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-08-24 02:24:25 -05:00
golangci-lint bundles gofumpt v0.8.0, which formats code differently from the v0.9.2 we pin in go.mod. Enforcing formatting through golangci-lint may therefore disagree with `just format`. Remove gofumpt from golangci-lint's formatters and instead run the pinned `go tool gofumpt` as a standalone check via a new scripts/gofumpt-check.sh, wired into CI, `just lint`, and `make lint`. goimports stays in golangci-lint; it's stable across versions and nothing runs a competing copy of it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
23 lines
662 B
Bash
Executable File
23 lines
662 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# Checks that all Go files are gofumpt-formatted, and fails if any aren't.
|
|
# Used by `just lint`, `make lint`, and CI. We run gofumpt with the version
|
|
# pinned in go.mod (via `go tool`) rather than the one bundled with
|
|
# golangci-lint, so that formatting is identical across all of them and the
|
|
# editor.
|
|
|
|
set -e
|
|
|
|
script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
|
repo_root=$(dirname "$script_dir")
|
|
|
|
cd "$repo_root"
|
|
|
|
unformatted=$(go tool gofumpt -l .)
|
|
if [ -n "$unformatted" ]; then
|
|
echo "The following files are not formatted correctly:"
|
|
echo "$unformatted"
|
|
echo "Run 'just format' (or 'make format') and commit the result."
|
|
exit 1
|
|
fi
|