Skip to content

Apply modernize#3750

Merged
raphael merged 8 commits into
v3from
modernize
Aug 7, 2025
Merged

Apply modernize#3750
raphael merged 8 commits into
v3from
modernize

Conversation

@tchssk

@tchssk tchssk commented Aug 1, 2025

Copy link
Copy Markdown
Member

@tchssk tchssk marked this pull request as ready for review August 2, 2025 05:15
@tchssk tchssk requested a review from Copilot August 2, 2025 05:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR applies modernization improvements to the codebase using the Go modernize tool. The changes leverage newer Go standard library features and language constructs to improve code clarity and maintainability.

  • Replace manual loop-based searches with slices.Contains() for cleaner array/slice membership checks
  • Use maps.Copy() instead of manual map copying loops for better performance and readability
  • Modernize for-loop syntax using range-over-integer pattern available in Go 1.22+
  • Replace interface{} with the more modern any type alias
  • Use min() builtin function and other standard library improvements

Reviewed Changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
security/scheme.go Replaces manual slice search with slices.Contains() for scope validation
middleware/xray/segment.go Consolidates function parameters, uses min() builtin, and modernizes for-loop syntax
middleware/sampler_test.go Updates for-loops to use range-over-integer syntax
http/middleware/xray/segment_test.go Uses http.NoBody and modernizes for-loop syntax
http/codegen/sse_client.go Replaces interface{} with any type alias
http/codegen/sse.go Replaces interface{} with any type alias
http/codegen/openapi/v3/types_test.go Updates function parameter type from interface{} to any
http/codegen/openapi/v3/parameters.go Replaces manual slice search with slices.Contains()
http/codegen/openapi/v3/builder.go Uses maps.Copy() instead of manual map copying
http/codegen/openapi/v2/builder.go Uses maps.Copy() and slices.Contains() for cleaner code
http/codegen/openapi/marshal.go Replaces manual map copying with maps.Copy()
http/codegen/openapi/extensions.go Uses maps.Copy() for map merging operations
http/client.go Uses fmt.Appendf() instead of manual slice formatting
grpc/middleware/xray/segment_test.go Modernizes for-loop syntax
expr/types.go Updates for-loops to use range-over-integer syntax
expr/server.go Replaces manual slice searches with slices.Contains()
expr/root.go Uses maps.Copy() and slices.Contains() for cleaner code
expr/mapped_attribute.go Uses maps.Copy() for map duplication
expr/http_endpoint_test.go Modernizes for-loop syntax
expr/http_endpoint.go Replaces multiple manual slice searches with slices.Contains()
expr/grpc_endpoint.go Uses slices.Contains() for cleaner membership checks
expr/example.go Uses min() builtin, modernizes for-loops, and renames shadowed variables
expr/attribute.go Replaces manual slice searches with slices.Contains()
dsl/result_type.go Uses built-in copy() function for slice copying
dsl/meta_test.go Uses slices.Contains() in test helper function
codegen/service/service_data.go Replaces manual slice search with slices.Contains()
codegen/service/interceptors.go Replaces interface{} with any type alias
codegen/funcs.go Consolidates function parameters and modernizes for-loop syntax
codegen/file.go Uses maps.Copy() and updates file permissions to be more restrictive

Comment thread codegen/file.go Outdated
raphael and others added 2 commits August 6, 2025 15:07
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@raphael

raphael commented Aug 7, 2025

Copy link
Copy Markdown
Member

This is great, thank you!

@raphael raphael merged commit 0dbdae1 into v3 Aug 7, 2025
9 checks passed
@raphael raphael deleted the modernize branch August 7, 2025 00:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants