From 8e779557c919591947217d0eaba450eff432a4ac Mon Sep 17 00:00:00 2001 From: Josh Gross Date: Thu, 11 Sep 2025 11:10:11 -0400 Subject: [PATCH 1/4] Add a workflow for linting and formatting --- .github/workflows/lint.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..451002c4 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,32 @@ +name: Lint + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + + - name: Set up Go + uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 + with: + go-version-file: go.mod + + - name: Run go fmt + run: | + if [ "$(go fmt ./... | wc -l)" -gt 0 ]; then + echo "The following files are not properly formatted:" + go fmt ./... + echo "Please run 'go fmt ./...' to fix formatting issues." + exit 1 + fi + + - name: golangci-lint + uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0 + with: + version: v2 From 6c003c84b40edecef71fa16ef65571970517f2c4 Mon Sep 17 00:00:00 2001 From: Josh Gross Date: Thu, 11 Sep 2025 11:13:27 -0400 Subject: [PATCH 2/4] Use latest linter --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 451002c4..f7937049 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -29,4 +29,4 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0 with: - version: v2 + version: latest From 2d5cd63ac6407e3882930031745d1155e7ff7a34 Mon Sep 17 00:00:00 2001 From: Josh Gross Date: Thu, 11 Sep 2025 11:15:34 -0400 Subject: [PATCH 3/4] Run linters from Makefile as well --- .github/workflows/lint.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index f7937049..72823013 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -26,6 +26,8 @@ jobs: exit 1 fi + - run: make lint + - name: golangci-lint uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0 with: From f901bd6fc07af4016b3ee53b8df0f2a0ea060dc2 Mon Sep 17 00:00:00 2001 From: Josh Gross Date: Thu, 11 Sep 2025 11:19:21 -0400 Subject: [PATCH 4/4] Disable `errcheck` for now --- .golangci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.golangci.yml b/.golangci.yml index a66e4f2c..58be3c6c 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -6,6 +6,8 @@ linters: - comments - common-false-positives - std-error-handling + disable: + - errcheck # TODO: reenable after fixing all existing issues formatters: enable: - goimports