From dbd57d6de38e7721a97a35a5ac6bda2b82ad010e Mon Sep 17 00:00:00 2001 From: Min Huang <70873102+min0625@users.noreply.github.com> Date: Tue, 21 Apr 2026 19:40:49 +0000 Subject: [PATCH] chore: update PR checks and dev tooling --- .devcontainer/post_create.sh | 2 ++ .github/workflows/pr-check.yml | 6 +++--- .golangci.yaml | 2 -- AGENTS.md | 2 -- Makefile | 13 ++++++++----- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.devcontainer/post_create.sh b/.devcontainer/post_create.sh index cf64f30..a190145 100644 --- a/.devcontainer/post_create.sh +++ b/.devcontainer/post_create.sh @@ -9,5 +9,7 @@ mise trust . mise install +mise exec -- go mod download + mise exec -- go install -v golang.org/x/tools/gopls@latest mise exec -- go install -v github.com/go-delve/delve/cmd/dlv@latest diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index 14c92c5..29e78aa 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -7,7 +7,7 @@ on: jobs: check: - name: Lint & Test + name: Check runs-on: ubuntu-latest steps: - name: Checkout @@ -21,5 +21,5 @@ jobs: - name: Download Go dependencies run: go mod download - - name: Run check (lint + test) - run: make check + - name: Run check + run: make check NEW_FROM_REV=origin/${{ github.base_ref }} diff --git a/.golangci.yaml b/.golangci.yaml index 8891809..eb3c803 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -5,9 +5,7 @@ run: timeout: 5m issues: - new: true whole-files: true - new-from-rev: HEAD~ max-same-issues: 50 severity: diff --git a/AGENTS.md b/AGENTS.md index 2207c49..d8bd7a7 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -49,7 +49,6 @@ All commands should be run from the repository root. | Command | Description | |---------|-------------| -| `make fmt` | Format all Go source files via `golangci-lint fmt` | | `make lint` | Run linter (`golangci-lint run`) | | `make fix` | Run linter with auto-fix (`golangci-lint run --fix`) | | `make test` | Run all tests with race detector (`go test -v -race -failfast ./...`) | @@ -62,7 +61,6 @@ Always run `make check` before considering a change complete. ### Code Style - Follow standard Go conventions (`gofmt`, `goimports`). -- Use `make fmt` to format code; do not manually reformat. - Exported symbols must have GoDoc comments. Keep them concise and consistent with the existing style. - Internal helpers (unexported) should be commented only when non-obvious. diff --git a/Makefile b/Makefile index 717f29c..78bf91e 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,16 @@ -fmt: - golangci-lint fmt -v ./... +NEW_FROM_REV ?= HEAD fix: - golangci-lint run -v --fix ./... + go mod tidy + golangci-lint run -v --new-from-rev=$(NEW_FROM_REV) --fix ./... lint: - golangci-lint run -v ./... + golangci-lint run -v --new-from-rev=$(NEW_FROM_REV) ./... test: go test -v -race -failfast ./... -check: lint test +check-tidy: + go mod tidy -diff + +check: check-tidy lint test