From f533bb107cb77f7e0ad681dd0db9c4757a56f38e Mon Sep 17 00:00:00 2001 From: Maksim Totmin Date: Mon, 14 Sep 2026 00:29:03 +0700 Subject: [PATCH] =?UTF-8?q?chore:=20=D0=BF=D0=BE=D0=BB=D0=B8=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=BA=D0=B0=20=D1=80=D0=B5=D0=BF=D0=BE=D0=B7=D0=B8=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - .gitattributes (LF-нормализация) - CI/Makefile: проверка go mod tidy (-diff) - template/README: заметка про удаление replace при копировании --- .gitattributes | 17 +++++++++++++++++ .gitea/workflows/ci.yml | 2 ++ Makefile | 9 +++++++-- template/README.md | 6 ++++-- 4 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..a857221 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,17 @@ +# Нормализация переводов строк: в репозитории — LF. +* text=auto eol=lf + +*.go text eol=lf +*.md text eol=lf +*.mod text eol=lf +*.sum text eol=lf +*.yml text eol=lf +*.yaml text eol=lf +*.json text eol=lf + +# Бинарные типы (на будущее) — не трогаем. +*.png binary +*.jpg binary +*.jpeg binary +*.gif binary +*.webp binary diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 1514aed..c7d4ba5 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -31,6 +31,8 @@ jobs: run: | unformatted=$(gofmt -l .) [ -z "$unformatted" ] || { echo "gofmt: требуется форматирование: $unformatted"; exit 1; } + - name: go mod tidy check + run: go mod tidy -diff - name: toolkit dependency quarantine run: | direct=$(go list -m -f '{{if not .Main}}{{if not .Indirect}}{{.Path}}{{end}}{{end}}' all) diff --git a/Makefile b/Makefile index 4802e91..9008a95 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ GO ?= go GOLANGCI_LINT ?= golangci-lint -.PHONY: test test-fast lint fmt tidy toolkit-deps ci +.PHONY: test test-fast lint fmt tidy tidy-check toolkit-deps ci # Тесты с race-детектором (основной гейт). test: @@ -27,6 +27,11 @@ fmt: tidy: $(GO) mod tidy +# Проверка, что go.mod/go.sum в tidy-состоянии (дрейф ловим в CI). +tidy-check: + @$(GO) mod tidy -diff >/dev/null 2>&1 || { echo "go.mod не tidy — запусти make tidy"; $(GO) mod tidy -diff; exit 1; } + @echo "tidy: ok" + # Карантин зависимостей: тулкит обязан оставаться stdlib + go-sdk # (+ yaml/toml в validate). Любая другая ПРЯМАЯ зависимость — ошибка. toolkit-deps: @@ -39,4 +44,4 @@ toolkit-deps: fi; \ echo "toolkit-deps: ok" -ci: test lint toolkit-deps +ci: test lint tidy-check toolkit-deps diff --git a/template/README.md b/template/README.md index e05a175..55e0883 100644 --- a/template/README.md +++ b/template/README.md @@ -7,8 +7,10 @@ 1. Скопируйте каталог и переименуйте модуль в `go.mod` (`example.com/forge-tool` → ваш путь). -2. Замените доменную логику в `internal/tools/tools.go`. -3. Соберите и проверьте: +2. Удалите из `go.mod` строку `replace git.totmin.ru/en2zmax/forge-toolkit => ..` + (она нужна только для сборки внутри этого репозитория). +3. Замените доменную логику в `internal/tools/tools.go`. +4. Соберите и проверьте: ```bash go mod tidy