From 813c59928a227907661a2b30dd0fd4edaeebedcb Mon Sep 17 00:00:00 2001 From: Walter Schulze Date: Thu, 20 Feb 2025 13:39:38 +0000 Subject: [PATCH 01/12] update go version to 1.24 --- .github/workflows/build.yaml | 2 +- go.mod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 55ebd72..c668316 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - go: [1.23] + go: [1.24] env: working-directory: ./src/github.com/goccmack/gocc diff --git a/go.mod b/go.mod index 6d0876a..12fa93c 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,5 @@ module github.com/goccmack/gocc -go 1.23 +go 1.24 require golang.org/x/mod v0.8.0 From 3c3a484199e190ad50b9195053ecb8089fdd8e6d Mon Sep 17 00:00:00 2001 From: Walter Schulze Date: Thu, 20 Feb 2025 13:44:12 +0000 Subject: [PATCH 02/12] try install-mode for golangci-lint --- .github/workflows/build.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index c668316..487d8e4 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -35,6 +35,7 @@ jobs: with: version: v1.60 working-directory: ${{env.working-directory}} + install-mode: "goinstall" - name: Check run: go get && make ci From a33c117988e73ac933d89f19843f10adf0f8de8f Mon Sep 17 00:00:00 2001 From: Walter Schulze Date: Thu, 20 Feb 2025 13:46:59 +0000 Subject: [PATCH 03/12] disable typecheck linter --- .golangci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.golangci.yml b/.golangci.yml index 8907909..62dcb03 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -17,3 +17,4 @@ linters: - depguard - govet - staticcheck + - typecheck From 1d2b67efb2c8b2187d27f798845b455e10dda724 Mon Sep 17 00:00:00 2001 From: Walter Schulze Date: Thu, 20 Feb 2025 13:50:34 +0000 Subject: [PATCH 04/12] try specifying the path of golangci.yml --- .github/workflows/build.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 487d8e4..47425b3 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -35,7 +35,8 @@ jobs: with: version: v1.60 working-directory: ${{env.working-directory}} - install-mode: "goinstall" + install-mode: "goinstall" # This is slow, but necessary if you are using a newer version of Go than golangci-lint supports + args: --config=./.golangci.yml - name: Check run: go get && make ci From c965d412636d79e782985bd6b41ef589f6e973ef Mon Sep 17 00:00:00 2001 From: Walter Schulze Date: Thu, 20 Feb 2025 13:52:52 +0000 Subject: [PATCH 05/12] change order of golangci-lint in CI --- .github/workflows/build.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 47425b3..d03f5d5 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -30,6 +30,10 @@ jobs: fetch-depth: 1 path: src/github.com/goccmack/gocc + - name: Check + run: go get && make ci + working-directory: ${{env.working-directory}} + - name: golangci-lint uses: golangci/golangci-lint-action@v6 with: @@ -38,7 +42,3 @@ jobs: install-mode: "goinstall" # This is slow, but necessary if you are using a newer version of Go than golangci-lint supports args: --config=./.golangci.yml - - name: Check - run: go get && make ci - working-directory: ${{env.working-directory}} - From 20114cc5b30f53f85133750b417e328ea8494c5f Mon Sep 17 00:00:00 2001 From: Walter Schulze Date: Thu, 20 Feb 2025 13:54:36 +0000 Subject: [PATCH 06/12] only apply linter in CI and not in make file --- Makefile | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index fa952bc..53d6ec3 100644 --- a/Makefile +++ b/Makefile @@ -15,11 +15,6 @@ gofmt: ## format all go files govet: ## run go's code vetting on all code go vet ./... -ci-lint: ## see https://golangci-lint.run/, applies .golangci.yml - golangci-lint run - -lint: govet ci-lint - goclean: gofmt ## apply go style rules to source regenerate: ## regenerate all example and test files @@ -27,9 +22,9 @@ regenerate: ## regenerate all example and test files make -C example regenerate make -C internal/test regenerate make goclean - make lint + make govet -check: ## regenerate, lint and run a terse version of check +check: ## regenerate and run a terse version of check @# quietly install and regenerate @go mod tidy @make --quiet install @@ -37,7 +32,6 @@ check: ## regenerate, lint and run a terse version of check @make --quiet -C internal/test regenerate @# promote formatting changes to errors @if [ -n "$(gofmt -l -s .)" ]; then { echo "gofmt errors:"; gofmt -d -l -s . ; exit 1; }; fi - @make --quiet lint @go test ./... | grep -v "\[no test" ci: ## run all ci checks From 37553c0de82dc8a5a4848d694ad326ba16c233c4 Mon Sep 17 00:00:00 2001 From: Walter Schulze Date: Thu, 20 Feb 2025 13:58:21 +0000 Subject: [PATCH 07/12] only install golangci-lint and do not run it. Use makefile to run it --- .github/workflows/build.yaml | 9 ++++----- .golangci.yml | 1 - Makefile | 10 ++++++++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index d03f5d5..6e4774b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -30,15 +30,14 @@ jobs: fetch-depth: 1 path: src/github.com/goccmack/gocc - - name: Check - run: go get && make ci - working-directory: ${{env.working-directory}} - - name: golangci-lint uses: golangci/golangci-lint-action@v6 with: version: v1.60 + verify: false working-directory: ${{env.working-directory}} install-mode: "goinstall" # This is slow, but necessary if you are using a newer version of Go than golangci-lint supports - args: --config=./.golangci.yml + - name: Check + run: go get && make ci + working-directory: ${{env.working-directory}} diff --git a/.golangci.yml b/.golangci.yml index 62dcb03..8907909 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -17,4 +17,3 @@ linters: - depguard - govet - staticcheck - - typecheck diff --git a/Makefile b/Makefile index 53d6ec3..fa952bc 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,11 @@ gofmt: ## format all go files govet: ## run go's code vetting on all code go vet ./... +ci-lint: ## see https://golangci-lint.run/, applies .golangci.yml + golangci-lint run + +lint: govet ci-lint + goclean: gofmt ## apply go style rules to source regenerate: ## regenerate all example and test files @@ -22,9 +27,9 @@ regenerate: ## regenerate all example and test files make -C example regenerate make -C internal/test regenerate make goclean - make govet + make lint -check: ## regenerate and run a terse version of check +check: ## regenerate, lint and run a terse version of check @# quietly install and regenerate @go mod tidy @make --quiet install @@ -32,6 +37,7 @@ check: ## regenerate and run a terse version of check @make --quiet -C internal/test regenerate @# promote formatting changes to errors @if [ -n "$(gofmt -l -s .)" ]; then { echo "gofmt errors:"; gofmt -d -l -s . ; exit 1; }; fi + @make --quiet lint @go test ./... | grep -v "\[no test" ci: ## run all ci checks From d4008441c248d2bc65e5ac14671362fd7fca7449 Mon Sep 17 00:00:00 2001 From: Walter Schulze Date: Thu, 20 Feb 2025 14:00:12 +0000 Subject: [PATCH 08/12] ignore issues --- .github/workflows/build.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 6e4774b..2daf1c3 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -35,6 +35,7 @@ jobs: with: version: v1.60 verify: false + args: --issues-exit-code=0 working-directory: ${{env.working-directory}} install-mode: "goinstall" # This is slow, but necessary if you are using a newer version of Go than golangci-lint supports From 9f863a15fd45c4e73c81f1cc50c6464ce4e7f483 Mon Sep 17 00:00:00 2001 From: Walter Schulze Date: Thu, 20 Feb 2025 14:03:24 +0000 Subject: [PATCH 09/12] disable typecheck --- .golangci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.golangci.yml b/.golangci.yml index 8907909..1e54404 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -16,4 +16,6 @@ linters: - unused - depguard - govet + - typecheck - staticcheck + From 44cccc16e7ce013be68ba91fd725a99bc93945c4 Mon Sep 17 00:00:00 2001 From: Walter Schulze Date: Thu, 20 Feb 2025 14:06:17 +0000 Subject: [PATCH 10/12] disable golangci-lint --- .golangci.yml | 1 - Makefile | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 1e54404..e551778 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -16,6 +16,5 @@ linters: - unused - depguard - govet - - typecheck - staticcheck diff --git a/Makefile b/Makefile index fa952bc..60b6e9a 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,9 @@ govet: ## run go's code vetting on all code ci-lint: ## see https://golangci-lint.run/, applies .golangci.yml golangci-lint run -lint: govet ci-lint +lint: + govet + ## ci-lint ## Disabled for go 1.24 until golangci-lint supports it goclean: gofmt ## apply go style rules to source From cef79ec398c52b552105ef3297a9cfb719745f6c Mon Sep 17 00:00:00 2001 From: Walter Schulze Date: Thu, 20 Feb 2025 14:08:39 +0000 Subject: [PATCH 11/12] add comments and fix makefile --- .github/workflows/build.yaml | 3 +-- Makefile | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 2daf1c3..4f2ee74 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -34,8 +34,7 @@ jobs: uses: golangci/golangci-lint-action@v6 with: version: v1.60 - verify: false - args: --issues-exit-code=0 + args: --issues-exit-code=0 # Do not care about output, we run golangci-lint in the Makefile again and then we do care. working-directory: ${{env.working-directory}} install-mode: "goinstall" # This is slow, but necessary if you are using a newer version of Go than golangci-lint supports diff --git a/Makefile b/Makefile index 60b6e9a..5bb4b60 100644 --- a/Makefile +++ b/Makefile @@ -19,8 +19,8 @@ ci-lint: ## see https://golangci-lint.run/, applies .golangci.yml golangci-lint run lint: - govet - ## ci-lint ## Disabled for go 1.24 until golangci-lint supports it + make govet + ## make ci-lint ## Temporarily disabled for go 1.24 until golangci-lint supports go 1.24 goclean: gofmt ## apply go style rules to source From d2c31c051365c57530d98728f699964be3f15e63 Mon Sep 17 00:00:00 2001 From: Walter Schulze Date: Thu, 20 Feb 2025 14:10:18 +0000 Subject: [PATCH 12/12] use tabs instead of spaces --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 5bb4b60..7ae29a2 100644 --- a/Makefile +++ b/Makefile @@ -19,8 +19,8 @@ ci-lint: ## see https://golangci-lint.run/, applies .golangci.yml golangci-lint run lint: - make govet - ## make ci-lint ## Temporarily disabled for go 1.24 until golangci-lint supports go 1.24 + make govet + ## make ci-lint ## Temporarily disabled for go 1.24 until golangci-lint supports go 1.24 goclean: gofmt ## apply go style rules to source