Repository navigation
feat: Integrate GolangCi linter - #105
Merged
Merged
Conversation
SVilgelm
commented
May 18, 2025
Member
- Add UnsupportedVersionError type for clearer OpenAPI version errors
- Refactor OpenAPI version validation to use the new error type
- Add //nolint directive to validation error creation to suppress err113 linter
- Update test helpers in components_test.go to accept testing.TB and call tb.Helper()
- Remove trailing blank line in operation tag validation for consistency
- Update go.mod to require Go 1.22
- Simplify Contact.validateSpec by ignoring validator parameter
- Minor cleanup in RefOrSpec switch case ordering and imports
- Add UnsupportedVersionError type for clearer OpenAPI version errors - Refactor OpenAPI version validation to use the new error type - Add //nolint directive to validation error creation to suppress err113 linter - Update test helpers in components_test.go to accept testing.TB and call tb.Helper() - Remove trailing blank line in operation tag validation for consistency - Update go.mod to require Go 1.22 - Simplify Contact.validateSpec by ignoring validator parameter - Minor cleanup in RefOrSpec switch case ordering and imports
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR integrates GolangCI-Lint and refactors OpenAPI validation and test helpers:
- Introduce
UnsupportedVersionErrorfor clearer version errors and updatevalidateSpec - Suppress unused‐parameter warnings in many
validateSpecmethods - Update component tests to use
testing.TB/tb.Helper()and bump Go to 1.22
Reviewed Changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| security-requirement.go | Suppress unused path param in validateSpec |
| schema.go | Fix spelling, simplify type check, adjust loop over fields |
| responses.go | Simplify regex using \d |
| ref.go | Introduce SpecNotFoundError and replace fmt.Errorf calls |
| parameter.go | Refactor name checks to switch, early exit on missing schema |
| operation.go | Remove trailing blank line in tag validation |
| openapi.go | Add UnsupportedVersionError and use it in version check |
| license.go | Drop unused validator param |
| external-docs.go | Drop unused validator param |
| extensions.go | Add UnsupportedSpecTypeError, tighten extension loop |
| example.go | Drop unused validator param |
| contact.go | Drop unused validator param |
| components_test.go | Change creators to accept testing.TB, call tb.Helper() |
| components.go | Simplify component name regex |
| callback.go | Return accumulated errors instead of nil in validateSpec |
| go.mod | Update Go version to 1.22 |
| .golangci.yml | Add/configure GolangCI-Lint |
| .github/workflows/code.yaml | Run GolangCI-Lint action, remove manual gofmt/go vet steps |
Comments suppressed due to low confidence (1)
schema.go:356
- The loop uses
range nwherenis an integer, which is invalid. It should be written asfor i := 0; i < n; i++ {to iterate over the struct fields correctly.
for i := range n {
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.