From 3d8d086ca370d242b3c49b1f2bf148c7b1fba409 Mon Sep 17 00:00:00 2001 From: Pranav RK Date: Sat, 17 May 2025 01:41:33 +0530 Subject: [PATCH 1/2] feat: add `golangci-lint-action` to the `lint` workflow --- .github/workflows/lint.yaml | 35 +++++------------------------------ 1 file changed, 5 insertions(+), 30 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 374715d6..3599d931 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -17,34 +17,9 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version-file: 'go.mod' + go-version-file: "go.mod" - - name: Verify dependencies - run: | - go mod verify - go mod download - - LINT_VERSION=2.1.6 - curl -fsSL https://github.com/golangci/golangci-lint/releases/download/v${LINT_VERSION}/golangci-lint-${LINT_VERSION}-linux-amd64.tar.gz | \ - tar xz --strip-components 1 --wildcards \*/golangci-lint - mkdir -p bin && mv golangci-lint bin/ - - - name: Run checks - run: | - STATUS=0 - assert-nothing-changed() { - local diff - "$@" >/dev/null || return 1 - if ! diff="$(git diff -U1 --color --exit-code)"; then - printf '\e[31mError: running `\e[1m%s\e[22m` results in modifications that you must check into version control:\e[0m\n%s\n\n' "$*" "$diff" >&2 - git checkout -- . - STATUS=1 - fi - } - - assert-nothing-changed go fmt ./... - assert-nothing-changed go mod tidy - - bin/golangci-lint run --timeout=3m || STATUS=$? - - exit $STATUS + - name: golangci-lint + uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 + with: + version: v2.1.6 From b620cc55c0e9af3fbb774c3ce447131f0b9084a0 Mon Sep 17 00:00:00 2001 From: Pranav RK Date: Mon, 19 May 2025 19:36:38 +0530 Subject: [PATCH 2/2] chore: revert `go mod` check --- .github/workflows/lint.yaml | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 3599d931..9fa416ab 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -17,7 +17,27 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version-file: "go.mod" + go-version-file: 'go.mod' + + - name: Verify dependencies + run: | + go mod verify + go mod download + + - name: Run checks + run: | + STATUS=0 + assert-nothing-changed() { + local diff + "$@" >/dev/null || return 1 + if ! diff="$(git diff -U1 --color --exit-code)"; then + printf '\e[31mError: running `\e[1m%s\e[22m` results in modifications that you must check into version control:\e[0m\n%s\n\n' "$*" "$diff" >&2 + git checkout -- . + STATUS=1 + fi + } + assert-nothing-changed go mod tidy + exit $STATUS - name: golangci-lint uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9