Skip to content

Conversation

@TomSweeneyRedHat
Copy link
Member

@TomSweeneyRedHat TomSweeneyRedHat commented Apr 16, 2025

Bump
c/storage v1.58.0
c/image v5.35.0
c/common v0.63.0

in preparation for Podman v5.5

Summary by Sourcery

Upgrade dependencies for Podman v5.5, including updates to c/storage, c/image, and c/common libraries

New Features:

  • Prepare project for Podman v5.5 release by updating core dependencies

Enhancements:

  • Bump project version to 0.64.0-dev
  • Update various Go dependencies to their latest versions

Bump
c/storage v1.58.0
c/image v5.35.0

in preparation for Podman v5.5

Signed-off-by: tomsweeneyredhat <[email protected]>
Bump c/common to v0.63.0 to be included in Podman v5.5.0

Signed-off-by: tomsweeneyredhat <[email protected]>
Bump to c/common to the next dev version, v0.64.0-dev

Signed-off-by: tomsweeneyredhat <[email protected]>
@sourcery-ai
Copy link

sourcery-ai bot commented Apr 16, 2025

Reviewer's Guide by Sourcery

This pull request bumps the c/storage, c/image, and c/common dependencies in preparation for Podman v5.5. It also updates indirect and vendored dependencies.

Updated class diagram for dependency versions

classDiagram
  class go_mod {
    -github.com/containers/image/v5 v5.34.4 ...
    +github.com/containers/image/v5 v5.35.0
    -github.com/containers/storage v1.57.3 ...
    +github.com/containers/storage v1.58.0
    -github.com/go-openapi/errors v0.22.0
    +github.com/go-openapi/errors v0.22.1
    -github.com/go-openapi/swag v0.23.0
    +github.com/go-openapi/swag v0.23.1
    -github.com/mailru/easyjson v0.7.7
    +github.com/mailru/easyjson v0.9.0
    -github.com/mattn/go-sqlite3 v1.14.24
    +github.com/mattn/go-sqlite3 v1.14.27
    -github.com/moby/sys/user v0.3.0
    +github.com/moby/sys/user v0.4.0
    -github.com/sigstore/protobuf-specs v0.4.0
    +github.com/sigstore/protobuf-specs v0.4.1
    -github.com/sigstore/rekor v1.3.9
    +github.com/sigstore/rekor v1.3.10
    -github.com/sigstore/sigstore v1.9.1
    +github.com/sigstore/sigstore v1.9.3
    -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.58.0
    +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.59.0
    -go.opentelemetry.io/otel v1.33.0
    +go.opentelemetry.io/otel v1.34.0
    -go.opentelemetry.io/otel/metric v1.33.0
    +go.opentelemetry.io/otel/metric v1.34.0
    -go.opentelemetry.io/otel/trace v1.33.0
    +go.opentelemetry.io/otel/trace v1.34.0
    -google.golang.org/genproto/googleapis/api v0.0.0-20241219192143-6b3ec007d9bb
    +google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb
    -google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f
    +google.golang.org/genproto/googleapis/rpc v0.0.0-20250313205543-e70fdf4c4cb4
    -google.golang.org/grpc v1.70.0
    +google.golang.org/grpc v1.71.0
    -google.golang.org/protobuf v1.36.5
    +google.golang.org/protobuf v1.36.6
  }
  note for go_mod "This class diagram shows the updated dependency versions in go.mod file."
Loading

File-Level Changes

Change Details Files
Update c/storage, c/image, and c/common dependencies to prepare for Podman v5.5.
  • Bumped github.com/containers/storage from v1.57.3 to v1.58.0.
  • Bumped github.com/containers/image/v5 from v5.34.4 to v5.35.0.
  • Bumped github.com/containers/common from v0.63.0-dev to v0.64.0-dev.
go.mod
version/version.go
Update indirect dependencies.
  • Bumped github.com/go-openapi/errors from v0.22.0 to v0.22.1.
  • Bumped github.com/go-openapi/swag from v0.23.0 to v0.23.1.
  • Bumped github.com/mattn/go-sqlite3 from v1.14.24 to v1.14.27.
  • Bumped github.com/moby/sys/user from v0.3.0 to v0.4.0.
  • Bumped github.com/sigstore/protobuf-specs from v0.4.0 to v0.4.1.
  • Bumped github.com/sigstore/rekor from v1.3.9 to v1.3.10.
  • Bumped github.com/sigstore/sigstore from v1.9.1 to v1.9.3.
  • Bumped go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp from v0.58.0 to v0.59.0.
  • Bumped go.opentelemetry.io/otel from v1.33.0 to v1.34.0.
  • Bumped go.opentelemetry.io/otel/metric from v1.33.0 to v1.34.0.
  • Bumped go.opentelemetry.io/otel/trace from v1.33.0 to v1.34.0.
  • Bumped google.golang.org/genproto/googleapis/api from v0.0.0-20241219192143-6b3ec007d9bb to v0.0.0-20250303144028-a0af3efb3deb.
  • Bumped google.golang.org/genproto/googleapis/rpc from v0.0.0-20250115164207-1a7da9e5054f to v0.0.0-20250313205543-e70fdf4c4cb4.
  • Bumped google.golang.org/grpc from v1.70.0 to v1.71.0.
  • Bumped google.golang.org/protobuf from v1.36.5 to v1.36.6.
  • Bumped github.com/mailru/easyjson from v0.7.7 to v0.9.0.
go.mod
Update vendored dependencies.
  • Updated vendored dependencies to match the updated direct and indirect dependencies.
vendor/github.com/containers/image/v5/image/unparsed.go
vendor/github.com/containers/image/v5/internal/image/unparsed.go
vendor/github.com/containers/image/v5/types/types.go
vendor/github.com/containers/image/v5/version/version.go
vendor/github.com/containers/storage/.golangci.yml
vendor/github.com/containers/storage/VERSION
vendor/github.com/containers/storage/containers.go
vendor/github.com/containers/storage/deprecated.go
vendor/github.com/containers/storage/drivers/btrfs/version.go
vendor/github.com/containers/storage/drivers/chown_unix.go
vendor/github.com/containers/storage/drivers/copy/copy_linux.go
vendor/github.com/containers/storage/drivers/driver.go
vendor/github.com/containers/storage/drivers/overlay/check.go
vendor/github.com/containers/storage/drivers/overlay/composefs.go
vendor/github.com/containers/storage/drivers/overlay/overlay.go
vendor/github.com/containers/storage/images.go
vendor/github.com/containers/storage/internal/dedup/dedup_linux.go
vendor/github.com/containers/storage/layers.go
vendor/github.com/containers/storage/pkg/archive/archive.go
vendor/github.com/containers/storage/pkg/archive/archive_linux.go
vendor/github.com/containers/storage/pkg/archive/archive_unix.go
vendor/github.com/containers/storage/pkg/archive/changes_linux.go
vendor/github.com/containers/storage/pkg/chunked/bloom_filter_linux.go
vendor/github.com/containers/storage/pkg/chunked/compression_linux.go
vendor/github.com/containers/storage/pkg/chunked/compressor/compressor.go
vendor/github.com/containers/storage/pkg/chunked/dump/dump.go
vendor/github.com/containers/storage/pkg/chunked/internal/minimal/compression.go
vendor/github.com/containers/storage/pkg/chunked/storage_linux.go
vendor/github.com/containers/storage/pkg/directory/directory_unix.go
vendor/github.com/containers/storage/pkg/ioutils/bytespipe.go
vendor/github.com/containers/storage/pkg/loopback/attach_loopback.go
vendor/github.com/containers/storage/pkg/loopback/loopback.go
vendor/github.com/containers/storage/pkg/pools/pools.go
vendor/github.com/containers/storage/pkg/reexec/reexec.go
vendor/github.com/containers/storage/pkg/stringutils/stringutils.go
vendor/github.com/containers/storage/pkg/system/stat_linux.go
vendor/github.com/containers/storage/pkg/unshare/unshare_linux.go
vendor/github.com/containers/storage/store.go
vendor/github.com/go-openapi/errors/.golangci.yml
vendor/github.com/go-openapi/errors/api.go
vendor/github.com/go-openapi/errors/headers.go
vendor/github.com/go-openapi/errors/middleware.go
vendor/github.com/go-openapi/errors/parsing.go
vendor/github.com/go-openapi/errors/schema.go
vendor/github.com/go-openapi/swag/.golangci.yml
vendor/github.com/go-openapi/swag/json.go
vendor/github.com/go-openapi/swag/loading.go
vendor/github.com/go-openapi/swag/yaml.go
vendor/github.com/mailru/easyjson/jlexer/bytestostr.go
vendor/github.com/mailru/easyjson/jlexer/lexer.go
vendor/github.com/mailru/easyjson/jwriter/writer.go
vendor/github.com/mattn/go-sqlite3/README.md
vendor/github.com/mattn/go-sqlite3/callback.go
vendor/github.com/mattn/go-sqlite3/sqlite3.go
vendor/github.com/mattn/go-sqlite3/sqlite3_opt_unlock_notify.c
vendor/github.com/mattn/go-sqlite3/sqlite3_opt_unlock_notify.go
vendor/github.com/sigstore/protobuf-specs/gen/pb-go/common/v1/sigstore_common.pb.go
vendor/github.com/sigstore/sigstore/pkg/signature/algorithm_registry.go
vendor/github.com/sigstore/sigstore/pkg/signature/ecdsa.go
vendor/github.com/sigstore/sigstore/pkg/signature/signer.go
vendor/github.com/sigstore/sigstore/pkg/signature/signerverifier.go
vendor/github.com/sigstore/sigstore/pkg/signature/util.go
vendor/github.com/sigstore/sigstore/pkg/signature/verifier.go
vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/handler.go
vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/env.go
vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/httpconv.go
vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/util.go
vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/v1.20.0.go
vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/transport.go
vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/version.go
vendor/go.opentelemetry.io/otel/CHANGELOG.md
vendor/go.opentelemetry.io/otel/README.md
vendor/go.opentelemetry.io/otel/RELEASING.md
vendor/go.opentelemetry.io/otel/renovate.json
vendor/go.opentelemetry.io/otel/version.go
vendor/go.opentelemetry.io/otel/versions.yaml
vendor/google.golang.org/genproto/googleapis/api/annotations/client.pb.go
vendor/google.golang.org/genproto/googleapis/api/annotations/http.pb.go
vendor/google.golang.org/genproto/googleapis/api/annotations/resource.pb.go
vendor/google.golang.org/genproto/googleapis/api/annotations/routing.pb.go
vendor/google.golang.org/genproto/googleapis/rpc/status/status.pb.go
vendor/google.golang.org/grpc/balancer/balancer.go
vendor/google.golang.org/grpc/balancer/pickfirst/pickfirstleaf/pickfirstleaf.go
vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin.go
vendor/google.golang.org/grpc/balancer/subconn.go
vendor/google.golang.org/grpc/balancer_wrapper.go
vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go
vendor/google.golang.org/grpc/clientconn.go
vendor/google.golang.org/grpc/dialoptions.go
vendor/google.golang.org/grpc/internal/balancer/gracefulswitch/gracefulswitch.go
vendor/google.golang.org/grpc/internal/envconfig/xds.go
vendor/google.golang.org/grpc/internal/internal.go
vendor/google.golang.org/grpc/internal/transport/http2_client.go
vendor/google.golang.org/grpc/internal/transport/proxy.go
vendor/google.golang.org/grpc/internal/transport/transport.go
vendor/google.golang.org/grpc/picker_wrapper.go
vendor/google.golang.org/grpc/resolver/resolver.go
vendor/google.golang.org/grpc/resolver_wrapper.go
vendor/google.golang.org/grpc/rpc_util.go
vendor/google.golang.org/grpc/server.go
vendor/google.golang.org/grpc/stream.go
vendor/google.golang.org/grpc/version.go
vendor/google.golang.org/protobuf/internal/filedesc/editions.go
vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go
vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go121.go
vendor/google.golang.org/protobuf/internal/version/version.go
vendor/google.golang.org/protobuf/proto/merge.go
vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go
vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go121.go
vendor/google.golang.org/protobuf/types/descriptorpb/descriptor.pb.go
vendor/google.golang.org/protobuf/types/gofeaturespb/go_features.pb.go
vendor/google.golang.org/protobuf/types/known/anypb/any.pb.go
vendor/google.golang.org/protobuf/types/known/durationpb/duration.pb.go
vendor/google.golang.org/protobuf/types/known/timestamppb/timestamp.pb.go
vendor/modules.txt
vendor/github.com/go-openapi/swag/errors.go
vendor/github.com/moby/sys/user/idtools.go
vendor/github.com/moby/sys/user/idtools_unix.go
vendor/github.com/moby/sys/user/idtools_windows.go
vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/gen.go
vendor/google.golang.org/grpc/balancer/endpointsharding/endpointsharding.go
vendor/google.golang.org/grpc/internal/proxyattributes/proxyattributes.go
vendor/google.golang.org/grpc/internal/resolver/delegatingresolver/delegatingresolver.go
vendor/github.com/containers/storage/drivers/btrfs/version_none.go
vendor/google.golang.org/grpc/internal/grpcsync/oncefunc.go
vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go120.go
vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go120.go

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @TomSweeneyRedHat - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Make sure to run go mod tidy to keep the go.mod and go.sum files consistent.
  • The version bump in version/version.go should be done in a separate commit.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 3 issues found
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

// If a custom decompressor is provided, it takes precedence. The function validates that the decompressed data
// does not exceed the specified maximum size and returns an error if this limit is exceeded.
// On success, it returns the decompressed data. Otherwise, it returns an error if decompression fails or the data exceeds the size limit.
func decompress(compressor encoding.Compressor, d mem.BufferSlice, dc Decompressor, maxReceiveMessageSize int, pool mem.BufferPool) (mem.BufferSlice, error) {
Copy link

Choose a reason for hiding this comment

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

issue (complexity): Consider extracting the custom and standard decompression logic into separate helper functions to reduce nesting and improve error handling in the decompress function.

Consider extracting the custom and standard decompression logic into separate helper functions. This will collapse the nested conditionals and make error handling more uniform. For example:

func decompress(compressor encoding.Compressor, d mem.BufferSlice, dc Decompressor, maxReceiveMessageSize int, pool mem.BufferPool) (mem.BufferSlice, error) {
    if dc != nil {
        return customDecompress(dc, d, maxReceiveMessageSize)
    }
    if compressor != nil {
        return standardDecompress(compressor, d, maxReceiveMessageSize, pool)
    }
    return nil, status.Errorf(codes.Internal, "grpc: no decompressor available for compressed payload")
}

func customDecompress(dc Decompressor, d mem.BufferSlice, maxReceiveMessageSize int) (mem.BufferSlice, error) {
    uncompressed, err := dc.Do(d.Reader())
    if err != nil {
        return nil, status.Errorf(codes.Internal, "grpc: failed to decompress the received message: %v", err)
    }
    if len(uncompressed) > maxReceiveMessageSize {
        return nil, status.Errorf(codes.ResourceExhausted, "grpc: message after decompression larger than max (%d vs. %d)",
            len(uncompressed), maxReceiveMessageSize)
    }
    return mem.BufferSlice{mem.SliceBuffer(uncompressed)}, nil
}

func standardDecompress(compressor encoding.Compressor, d mem.BufferSlice, maxReceiveMessageSize int, pool mem.BufferPool) (mem.BufferSlice, error) {
    dcReader, err := compressor.Decompress(d.Reader())
    if err != nil {
        return nil, status.Errorf(codes.Internal, "grpc: failed to decompress the message: %v", err)
    }
    out, err := mem.ReadAll(io.LimitReader(dcReader, int64(maxReceiveMessageSize)), pool)
    if err != nil {
        out.Free()
        return nil, status.Errorf(codes.Internal, "grpc: failed to read decompressed data: %v", err)
    }
    if out.Len() == maxReceiveMessageSize && !atEOF(dcReader) {
        out.Free()
        return nil, status.Errorf(codes.ResourceExhausted, "grpc: received message after decompression larger than max %d", maxReceiveMessageSize)
    }
    return out, nil
}

This refactoring maintains all existing functionality while reducing the complexity of the main decompress function.

// the end of the UpdateClientConnState operation. If any endpoint has no
// addresses it will ignore that endpoint. Otherwise, returns first error found
// from a child, but fully processes the new update.
func (es *endpointSharding) UpdateClientConnState(state balancer.ClientConnState) error {
Copy link

Choose a reason for hiding this comment

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

issue (complexity): Consider encapsulating lock handling in helper functions to narrow lock scope and improve code clarity by reducing nested defers and cognitive load related to mutex management, which can be applied to methods like UpdateClientConnState and ResolverError for better lock boundary management and reduced overlapping lock scopes..

Consider encapsulating the lock-handling in small helper functions to narrow the scope of each lock. This can help reduce the cognitive load of tracking when each mutex is held or released, and it can also eliminate some nested defers. For example, you could add generic helpers for the two locked sections:

func (es *endpointSharding) withChildLock(fn func()) {
    es.childMu.Lock()
    defer es.childMu.Unlock()
    fn()
}

func (es *endpointSharding) withStateLock(fn func()) {
    es.mu.Lock()
    defer es.mu.Unlock()
    fn()
}

Then refactor methods like UpdateClientConnState to use these helpers. For instance:

func (es *endpointSharding) UpdateClientConnState(state balancer.ClientConnState) error {
    var ret error
    es.withChildLock(func() {
        es.inhibitChildUpdates.Store(true)
        defer func() {
            es.inhibitChildUpdates.Store(false)
        }()
        // Update and create new children.
        children := es.children.Load()
        newChildren := resolver.NewEndpointMap()
        for _, endpoint := range state.ResolverState.Endpoints {
            if _, ok := newChildren.Get(endpoint); ok {
                continue
            }
            var childBalancer *balancerWrapper
            if val, ok := children.Get(endpoint); ok {
                childBalancer = val.(*balancerWrapper)
                es.withStateLock(func() {
                    childBalancer.childState.Endpoint = endpoint
                })
            } else {
                childBalancer = &balancerWrapper{
                    childState: ChildState{Endpoint: endpoint},
                    ClientConn: es.cc,
                    es:         es,
                }
                childBalancer.childState.Balancer = childBalancer
                childBalancer.child = es.childBuilder(childBalancer, es.bOpts)
            }
            newChildren.Set(endpoint, childBalancer)
            if err := childBalancer.updateClientConnStateLocked(balancer.ClientConnState{
                BalancerConfig: state.BalancerConfig,
                ResolverState: resolver.State{
                    Endpoints:  []resolver.Endpoint{endpoint},
                    Attributes: state.ResolverState.Attributes,
                },
            }); err != nil && ret == nil {
                ret = err
            }
        }
        // Delete removed children.
        for _, e := range children.Keys() {
            if child, ok := newChildren.Get(e); !ok {
                child.(*balancerWrapper).closeLocked()
            }
        }
        es.children.Store(newChildren)
    })
    es.updateState()
    if newChildren := es.children.Load(); newChildren.Len() == 0 {
        return balancer.ErrBadResolverState
    }
    return ret
}

This refactoring preserves functionality but clarifies locking boundaries by centralizing the lock management. Repeat similar shifting for ResolverError and other methods to reduce overlapping lock scopes and nested defers.

// target address as the attribute along with user info. It returns nil if
// either resolver has not sent update even once and returns the error from
// ClientConn update once both resolvers have sent update atleast once.
func (r *delegatingResolver) updateClientConnStateLocked() error {
Copy link

Choose a reason for hiding this comment

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

issue (complexity): Consider extracting the nested loops in updateClientConnStateLocked into helper functions to improve readability by isolating the combination logic and making the state update easier to follow, without changing functionality

Below is one actionable approach to reducing complexity without changing functionality: extract the nested loops in updateClientConnStateLocked into helper functions. This isolates the combination logic and makes the state update easier to follow. For example, you could refactor as follows:

func (r *delegatingResolver) combineAddresses(proxyAddr resolver.Address, targetAddrs []resolver.Address) []resolver.Address {
	var addresses []resolver.Address
	for _, tAddr := range targetAddrs {
		addresses = append(addresses, proxyattributes.Set(proxyAddr, proxyattributes.Options{
			User:        r.proxyURL.User,
			ConnectAddr: tAddr.Addr,
		}))
	}
	return addresses
}

func (r *delegatingResolver) combineEndpoints(proxyAddrs []resolver.Address, endpoints []resolver.Endpoint) []resolver.Endpoint {
	var combined []resolver.Endpoint
	for _, ep := range endpoints {
		var addrs []resolver.Address
		for _, pAddr := range proxyAddrs {
			for _, tAddr := range ep.Addresses {
				addrs = append(addrs, proxyattributes.Set(pAddr, proxyattributes.Options{
					User:        r.proxyURL.User,
					ConnectAddr: tAddr.Addr,
				}))
			}
		}
		combined = append(combined, resolver.Endpoint{Addresses: addrs})
	}
	return combined
}

Then, update updateClientConnStateLocked as follows:

func (r *delegatingResolver) updateClientConnStateLocked() error {
	if r.targetResolverState == nil || r.proxyAddrs == nil {
		return nil
	}

	curState := *r.targetResolverState
	var proxyAddr resolver.Address
	if len(r.proxyAddrs) == 1 {
		proxyAddr = r.proxyAddrs[0]
	} else {
		proxyAddr = resolver.Address{Addr: r.proxyURL.Host}
	}

	curState.Addresses = r.combineAddresses(proxyAddr, curState.Addresses)
	curState.Endpoints = r.combineEndpoints(r.proxyAddrs, curState.Endpoints)
	return r.cc.UpdateState(curState)
}

This change reduces the inline nested loops and clarifies the responsibilities of each helper function while retaining the original behavior.

@TomSweeneyRedHat
Copy link
Member Author

Podman Test PR: containers/podman#25900

@TomSweeneyRedHat
Copy link
Member Author

Happy Green Test Buttons, and the Podman PR passed tests. Ready to go. If we want to track down the suggestions, I'm happy to do that in a follow up, but timing wise I'd like to push this across the line now.

Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

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

LGTM

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Apr 17, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Luap99, sourcery-ai[bot], TomSweeneyRedHat

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [Luap99,TomSweeneyRedHat]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@mheon
Copy link
Member

mheon commented Apr 17, 2025

Can we turn the Sourcery thing off for vendor/? It's not useful to suggest code changes to libraries we don't maintain.

/lgtm

@mheon
Copy link
Member

mheon commented Apr 17, 2025

@TomSweeneyRedHat Should this still be marked WIP?

@TomSweeneyRedHat
Copy link
Member Author

@Luap99 Nope, I forgot to remove that last night. Removed now.

@openshift-merge-bot openshift-merge-bot bot merged commit bb92ade into containers:main Apr 17, 2025
15 checks passed
@TomSweeneyRedHat TomSweeneyRedHat deleted the dev/tsweeney/v0.63.0 branch April 17, 2025 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants