diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6b3523c..efa2559 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: with: fetch-depth: 2 - - uses: actions/setup-go@v6 + - uses: actions/setup-go@v7 with: go-version: "^1.26.0" - run: go version @@ -29,7 +29,7 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v9 with: - version: v2.12.2 + version: v2.14.0 args: --verbose --timeout=3m - name: Test diff --git a/.github/workflows/claude-review.yml b/.github/workflows/claude-review.yml index 66c96dc..3e8b00a 100644 --- a/.github/workflows/claude-review.yml +++ b/.github/workflows/claude-review.yml @@ -68,7 +68,7 @@ jobs: # 7. Security: code scanning, secret scanning, dependabot # 8. Bash gh: gh pr view/diff, gh issue view, gh api claude_args: | - --model claude-opus-4-6 + --model claude-opus-5-5 --max-turns 50 --allowedTools "Task,Read,Glob,Grep,mcp__github__get_pull_request,mcp__github__get_pull_request_diff,mcp__github__pull_request_read,mcp__github__list_pull_requests,mcp__github__search_pull_requests,mcp__github__create_pending_pull_request_review,mcp__github__add_comment_to_pending_review,mcp__github__submit_pending_pull_request_review,mcp__github__add_reply_to_pull_request_comment,mcp__github__get_file_contents,mcp__github__get_repository_tree,mcp__github__list_commits,mcp__github__get_commit,mcp__github__search_code,mcp__github__issue_read,mcp__github__search_issues,mcp__github__list_issues,mcp__github__actions_get,mcp__github__get_job_logs,mcp__github__list_code_scanning_alerts,mcp__github__get_code_scanning_alert,mcp__github__list_secret_scanning_alerts,mcp__github__get_secret_scanning_alert,mcp__github__list_dependabot_alerts,mcp__github__get_dependabot_alert,Bash(gh pr view:*),Bash(gh pr diff:*),Bash(gh issue view:*),Bash(gh api:*)" diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml index b19dd21..1583670 100644 --- a/.github/workflows/claude.yml +++ b/.github/workflows/claude.yml @@ -38,14 +38,14 @@ jobs: with: fetch-depth: 0 - - uses: actions/setup-go@v6 + - uses: actions/setup-go@v7 with: go-version: '^1.26.0' - name: Install golangci-lint uses: golangci/golangci-lint-action@v9 with: - version: v2.12.2 + version: v2.14.0 install-mode: binary skip-build-cache: true skip-save-cache: true @@ -79,7 +79,7 @@ jobs: # 9. CI/CD: actions get/list, job logs # 10. Security: code scanning, secret scanning, dependabot claude_args: | - --model claude-opus-4-6 + --model claude-opus-5-5 --max-turns 50 --append-system-prompt "IMPORTANT: Read README.md at the repository root to understand what the project does (it generates Zod schemas and TypeScript types from Go structs) and its conventions before starting any work. After making ANY code changes and BEFORE committing, you MUST format, lint, and test. Follow these steps: 1. Run 'make format' to format changed .go files. 2. Run 'make lint' and fix any reported issues. 3. If your changes affect the generated Zod/TypeScript output, run 'make test-update' to regenerate the golden files, then review the diff to confirm every change is intended. 4. Run 'make test' and 'make docker-test' and fix any failures. Do NOT commit code that has lint errors or test failures, and do NOT commit golden file changes you have not reviewed." --allowedTools "Task,Read,Edit,Write,Glob,Grep,WebFetch,Bash(go *),Bash(make *),Bash(git *),Bash(git rebase:*),Bash(golangci-lint *),Bash(ls *),Bash(gh pr view:*),Bash(gh pr diff:*),Bash(gh issue view:*),Bash(gh api:*),mcp__github_file_ops__commit_files,mcp__github_file_ops__update_claude_comment,mcp__github__issue_read,mcp__github__issue_write,mcp__github__add_issue_comment,mcp__github__list_issues,mcp__github__search_issues,mcp__github__pull_request_read,mcp__github__create_pull_request,mcp__github__update_pull_request,mcp__github__update_pull_request_branch,mcp__github__list_pull_requests,mcp__github__search_pull_requests,mcp__github__create_pending_pull_request_review,mcp__github__add_comment_to_pending_review,mcp__github__submit_pending_pull_request_review,mcp__github__add_reply_to_pull_request_comment,mcp__github__get_file_contents,mcp__github__get_repository_tree,mcp__github__list_commits,mcp__github__get_commit,mcp__github__search_code,mcp__github__create_branch,mcp__github__list_branches,mcp__github__actions_get,mcp__github__actions_list,mcp__github__get_job_logs,mcp__github__list_code_scanning_alerts,mcp__github__get_code_scanning_alert,mcp__github__list_secret_scanning_alerts,mcp__github__get_secret_scanning_alert,mcp__github__list_dependabot_alerts,mcp__github__get_dependabot_alert" diff --git a/.golangci.yml b/.golangci.yml index f180194..dbba415 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,4 +1,4 @@ -# Based on Golden config for golangci-lint v2.12.2 by Marat Reymers. +# Based on Golden config for golangci-lint v2.14.0 by Marat Reymers. # Licensed under the MIT License. # https://github.com/maratori/golangci-lint-config @@ -140,7 +140,7 @@ linters: ## you may want to enable #- arangolint # opinionated best practices for arangodb client #- decorder # checks declaration order and count of types, constants, variables and functions - #- exhaustruct # [highly recommend to enable] checks if all structure fields are initialized + #- exhaustruct_v5 # [highly recommend to enable] checks if all structure fields are initialized #- ginkgolinter # [if you use ginkgo/gomega] enforces standards of using ginkgo and gomega #- godox # detects usage of FIXME, TODO and other keywords inside comments #- goheader # checks is file header matches to pattern @@ -161,6 +161,7 @@ linters: #- dupword # [useless without config] checks for duplicate words in the source code #- err113 # [too strict] checks the errors handling expressions #- errchkjson # [don't see profit + I'm against of omitting errors like in the first example https://github.com/breml/errchkjson] checks types passed to the json encoding functions. Reports unsupported types and optionally reports occasions, where the check for the returned error can be omitted + #- exhaustruct # [use exhaustruct_v5 instead] checks if all structure fields are initialized #- forcetypeassert # [replaced by errcheck] finds forced type assertions #- gomodguard_v2: [use more powerful depguard] allow and blocklist linter for direct Go module dependencies #- gosmopolitan # reports certain i18n/l10n anti-patterns in your Go codebase @@ -251,15 +252,15 @@ linters: - switch - map - exhaustruct: - # List of regular expressions to match type names that should be excluded from processing. + exhaustruct_v5: + # List of regular expressions to match type names that should be skipped from checking. # Anonymous structs can be matched by '' alias. # Has precedence over `include`. # Each regular expression must match the full type name, including package path. # For example, to match type `net/http.Cookie` regular expression should be `.*/http\.Cookie`, # but not `http\.Cookie`. # Default: [] - exclude: + ignore-patterns: # std libs - ^net/http.Client$ - ^net/http.Cookie$ @@ -286,6 +287,9 @@ linters: # Allows empty structures in return statements. # Default: false allow-empty-returns: true + # Allow empty literals the blank identifier receives. + # Default: false + allow-empty-blank-assignments: true funcorder: # Checks if the exported methods of a structure are placed before the non-exported ones. @@ -400,6 +404,9 @@ linters: # Optimizes into strings concatenation. # Default: true strconcat: false + # Enable/disable optimization of error formatting. + # Default: true + error-format: false # https://github.com/catenacyber/perfsprint/issues/62 reassign: # Patterns for global variable names that are checked for reassignment. diff --git a/Makefile b/Makefile index ac268ce..4c8203d 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ MODULES = . ./custom/decimal ./custom/optional linters-install: @golangci-lint --version >/dev/null 2>&1 || { \ echo "installing linting tools..."; \ - curl -sSfL https://golangci-lint.run/install.sh | sh -s -- -b $$(go env GOPATH)/bin v2.12.2; \ + curl -sSfL https://golangci-lint.run/install.sh | sh -s -- -b $$(go env GOPATH)/bin v2.14.0; \ } lint: linters-install diff --git a/custom/decimal/go.mod b/custom/decimal/go.mod index ec0fb8f..d026ff8 100644 --- a/custom/decimal/go.mod +++ b/custom/decimal/go.mod @@ -7,12 +7,7 @@ replace github.com/hypersequent/zen => ../.. require ( github.com/hypersequent/zen v0.0.0-00010101000000-000000000000 github.com/shopspring/decimal v1.4.0 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 ) -require ( - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/kr/text v0.2.0 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect -) +require go.yaml.in/yaml/v3 v3.0.5 // indirect diff --git a/custom/decimal/go.sum b/custom/decimal/go.sum index 55abd16..86a329b 100644 --- a/custom/decimal/go.sum +++ b/custom/decimal/go.sum @@ -1,22 +1,8 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k= github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -github.com/xorcare/golden v0.8.3 h1:0sFBpM6/ju8YzhN2akrsPTgm6YEuIwuh0JaeAk5Ne3g= -github.com/xorcare/golden v0.8.3/go.mod h1:lRw6LV+0Pp37EBDMR4sXIz4Y7r75dDZ6bYm0ILDpIHY= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +github.com/xorcare/golden v0.8.4 h1:HzKYLy0CL1JTZu5ZwXKrZLLIjnqZJL0f11osydG0tnQ= +github.com/xorcare/golden v0.8.4/go.mod h1:7SmXXPag5JmyHXF3dAiQ9eW5LsnKAMqGTQ8fvPFAJM8= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/custom/optional/go.mod b/custom/optional/go.mod index 9a0c29f..29db1bb 100644 --- a/custom/optional/go.mod +++ b/custom/optional/go.mod @@ -7,12 +7,7 @@ replace github.com/hypersequent/zen => ../.. require ( 4d63.com/optional v0.2.0 github.com/hypersequent/zen v0.0.0-00010101000000-000000000000 - github.com/stretchr/testify v1.11.1 + github.com/stretchr/testify v1.12.1 ) -require ( - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/kr/text v0.2.0 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect -) +require go.yaml.in/yaml/v3 v3.0.5 // indirect diff --git a/custom/optional/go.sum b/custom/optional/go.sum index efde34d..15c6829 100644 --- a/custom/optional/go.sum +++ b/custom/optional/go.sum @@ -1,22 +1,8 @@ 4d63.com/optional v0.2.0 h1:VtMa/Iy8Xn5JuIqJYwDScgBSBsZsKCwP7s35NiUB+8A= 4d63.com/optional v0.2.0/go.mod h1:DBA8tAdkYkYbvRq1lK3FyDBBzioAJzZzQPC6Vj+a3jk= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -github.com/xorcare/golden v0.8.3 h1:0sFBpM6/ju8YzhN2akrsPTgm6YEuIwuh0JaeAk5Ne3g= -github.com/xorcare/golden v0.8.3/go.mod h1:lRw6LV+0Pp37EBDMR4sXIz4Y7r75dDZ6bYm0ILDpIHY= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= +github.com/xorcare/golden v0.8.4 h1:HzKYLy0CL1JTZu5ZwXKrZLLIjnqZJL0f11osydG0tnQ= +github.com/xorcare/golden v0.8.4/go.mod h1:7SmXXPag5JmyHXF3dAiQ9eW5LsnKAMqGTQ8fvPFAJM8= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= diff --git a/docker-test.sh b/docker-test.sh index 5081e27..d245410 100755 --- a/docker-test.sh +++ b/docker-test.sh @@ -18,7 +18,7 @@ echo "" docker run --rm \ -v "${PROJECT_DIR}/testdata:/golden:ro" \ -v "${PROJECT_DIR}/tests:/tests:ro" \ - node:22-alpine \ + node:24-alpine \ sh -c ' set -e @@ -73,10 +73,11 @@ for dir in zod3 zod4; do "compilerOptions": { "strict": true, "noEmit": true, - "moduleResolution": "node", + "moduleResolution": "bundler", "esModuleInterop": true, "target": "ES2020", - "module": "ES2020" + "module": "ES2020", + "skipLibCheck": true }, "include": ["*.ts"] } @@ -87,7 +88,7 @@ cat > /test/zod3/package.json < /test/zod4/package.json <