-
-
Notifications
You must be signed in to change notification settings - Fork 214
feat: Update minimum Go version to 1.21 #547
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe recent updates enhance the CI workflow for a Go project by introducing support for multiple Go versions and updating dependencies. Documentation was adjusted to reflect a new minimum Go version requirement. Additionally, unnecessary custom functions were removed in favor of standard library functions, streamlining the codebase and improving code quality. These changes collectively aim to enhance compatibility, maintainability, and performance across the project. Changes
Sequence Diagram(s)sequenceDiagram
participant Developer
participant CI
participant GoVersion
participant Dependencies
Developer->>CI: Initiates CI process
CI->>GoVersion: Tests across 1.21, 1.22, 1.23
CI->>Dependencies: Checks updates for actions
Dependencies-->>CI: Confirms new versions
CI-->>Developer: CI results and compatibility report
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
examples/go.sum
is excluded by!**/*.sum
Files selected for processing (12)
- .github/workflows/ci.yaml (1 hunks)
- README.md (1 hunks)
- README_CN.md (1 hunks)
- adapters/humaflow/flow/flow.go (3 hunks)
- casing/casing.go (1 hunks)
- docs/docs/tutorial/installation.md (1 hunks)
- examples/go.mod (2 hunks)
- go.mod (1 hunks)
- huma.go (4 hunks)
- registry.go (1 hunks)
- schema_test.go (1 hunks)
- validate_test.go (1 hunks)
Files skipped from review due to trivial changes (6)
- README.md
- README_CN.md
- adapters/humaflow/flow/flow.go
- examples/go.mod
- go.mod
- validate_test.go
Additional context used
GitHub Check: Build & Test (1.21)
registry.go
[failure] 145-145:
the given struct should be annotated with thejson
tag (musttag)casing/casing.go
[failure] 295-295:
SA1019: strings.Title has been deprecated since Go 1.18 and an alternative has been available since Go 1.0: The rule Title uses for word boundaries does not handle Unicode punctuation properly. Use golang.org/x/text/cases instead. (staticcheck)schema_test.go
[failure] 1215-1215:
the given struct should be annotated with thejson
tag (musttag)
[failure] 1222-1222:
the given struct should be annotated with thejson
tag (musttag)
golangci-lint
casing/casing.go
295-295: SA1019: strings.Title has been deprecated since Go 1.18 and an alternative has been available since Go 1.0: The rule Title uses for word boundaries does not handle Unicode punctuation properly. Use golang.org/x/text/cases instead.
(staticcheck)
Additional comments not posted (7)
.github/workflows/ci.yaml (4)
9-11
: Good addition of matrix strategy for Go versions.The introduction of a strategy matrix for Go versions (1.21, 1.22, 1.23) enhances the CI workflow by ensuring compatibility across multiple versions. This helps catch issues early when upgrading Go versions.
14-14
: Update toactions/checkout@v4
is beneficial.Updating
actions/checkout
to v4 ensures that the workflow benefits from the latest features and fixes. Ensure compatibility with any specific features used in the workflow.
16-18
: Upgrade toactions/setup-go@v5
is a positive change.The update to
actions/setup-go@v5
aligns with the latest features and improvements. This is crucial for setting up the Go environment effectively.
20-22
: Upgrade togolangci-lint-action@v6
enhances linting capabilities.Updating
golangci-lint-action
to v6 ensures the latest linting features and bug fixes are available, improving code quality checks. Verify any configuration changes needed for the new version.docs/docs/tutorial/installation.md (1)
9-9
: Documentation correctly updated for Go 1.21.The change in the prerequisite to Go 1.21 ensures users are aware of the updated compatibility requirements. This aligns with the project's move to support newer Go versions.
registry.go (1)
145-145
: Consider addingjson
tags to the struct fields.The removal of the
//nolint:musttag
directive is a positive step towards cleaner code. However, consider addingjson
tags to the struct fields to comply with the linter's suggestion and improve JSON serialization clarity.Verification successful
Consider adding
json
tags to themapRegistry
struct fields.The
mapRegistry
struct inregistry.go
does not currently have JSON tags on its fields. Adding these tags would enhance the clarity of JSON serialization and align with linter recommendations.
- File:
registry.go
- Struct:
mapRegistry
- Fields without JSON tags:
prefix
,schemas
,types
,seen
,namer
,aliases
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the presence of json tags in the mapRegistry struct fields. # Test: Search for struct fields in mapRegistry that lack json tags. ast-grep --lang go --pattern $'type mapRegistry struct { $_$ }'Length of output: 66
Script:
#!/bin/bash # Search for the definition of the mapRegistry struct and display its fields. rg 'type mapRegistry struct' -A 10Length of output: 485
Tools
GitHub Check: Build & Test (1.21)
[failure] 145-145:
the given struct should be annotated with thejson
tag (musttag)huma.go (1)
21-21
: Good use of theslices
package.The replacement of custom slice utility functions with
slices.Contains
from the standard library improves maintainability and performance.Also applies to: 129-129, 405-405
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #547 +/- ##
==========================================
- Coverage 92.76% 92.75% -0.02%
==========================================
Files 22 22
Lines 3886 3879 -7
==========================================
- Hits 3605 3598 -7
Misses 236 236
Partials 45 45 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- .github/workflows/ci.yaml (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- .github/workflows/ci.yaml
This PR updates the minimum Go version to 1.21 from 1.20. This aligns with the Go release policy regarding supported versions, from https://go.dev/doc/devel/release:
In addition, this updates some build dependencies & enables matrix builds to ensure features incompatible with Go 1.21 don't sneak into the codebase until we are ready to upgrade to 1.22 as the minimum.
This helps to address #543.
Summary by CodeRabbit
New Features
Bug Fixes
Chores