Skip to content

new errors with golangci-lint 1.64 #1932

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

Closed
chmouel opened this issue Feb 14, 2025 · 0 comments · Fixed by #1933
Closed

new errors with golangci-lint 1.64 #1932

chmouel opened this issue Feb 14, 2025 · 0 comments · Fixed by #1933
Assignees
Labels
good first issue Good for newcomers

Comments

@chmouel
Copy link
Member

chmouel commented Feb 14, 2025

Linting go files...
WARN The linter 'tenv' is deprecated (since v1.64.0) due to: Duplicate feature another linter. Replaced by usetesting. 
pkg/templates/templating.go:77:7: right hand must be only type assertion (forcetypeassert)
						b, err = raw.(*structpb.Value).MarshalJSON()
						^
pkg/templates/templating.go:85:7: right hand must be only type assertion (forcetypeassert)
						b, err = raw.(*structpb.Value).MarshalJSON()
						^
pkg/templates/templating.go:93:7: right hand must be only type assertion (forcetypeassert)
						s, err := protojson.Marshal(raw.(proto.Message))
						^
pkg/templates/templating.go:101:7: right hand must be only type assertion (forcetypeassert)
						s, err := protojson.Marshal(raw.(proto.Message))
						^
pkg/templates/templating.go:109:7: right hand must be only type assertion (forcetypeassert)
						b, err = json.Marshal(raw.(*structpb.Value).GetBoolValue())
						^
make: *** [Makefile:86: lint-go] Error 1
@chmouel chmouel added the good first issue Good for newcomers label Feb 14, 2025
chmouel added a commit to chmouel/pipelines-as-code that referenced this issue Feb 14, 2025
Go 1.22 introduced a restriction where type assertions in multiple
assignments must be standalone.

This fix ensures compliance by:
- Separating type assertions before passing values to functions.
- Adding error handling for failed assertions to prevent runtime panics.
- Consolidating duplicate cases for cleaner logic.

This resolves golangci-lint 'forcetypeassert' errors.

Fixes openshift-pipelines#1932

Signed-off-by: Chmouel Boudjnah <[email protected]>
chmouel added a commit to chmouel/pipelines-as-code that referenced this issue Feb 14, 2025
Go 1.22 introduced a restriction where type assertions in multiple
assignments must be standalone.

This fix ensures compliance by:
- Separating type assertions before passing values to functions.
- Adding error handling for failed assertions to prevent runtime panics.
- Consolidating duplicate cases for cleaner logic.

This resolves golangci-lint 'forcetypeassert' errors.

Fixes openshift-pipelines#1932

Signed-off-by: Chmouel Boudjnah <[email protected]>
pipelines-as-code bot pushed a commit that referenced this issue Feb 14, 2025
Go 1.22 introduced a restriction where type assertions in multiple
assignments must be standalone.

This fix ensures compliance by:
- Separating type assertions before passing values to functions.
- Adding error handling for failed assertions to prevent runtime panics.
- Consolidating duplicate cases for cleaner logic.

This resolves golangci-lint 'forcetypeassert' errors.

Fixes #1932

Signed-off-by: Chmouel Boudjnah <[email protected]>
@chmouel chmouel self-assigned this Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Development

Successfully merging a pull request may close this issue.

1 participant