Skip to content

Conversation

@mdelapenya
Copy link
Member

  • chore(volume): return pointer to volume in FindByID
  • chore: more resiliency in tests

What does this PR do?

It returns a pointer instead of struct when finding volumes by ID.

Why is it important?

It allows consumers of this module to check for nil

Copilot AI review requested due to automatic review settings October 15, 2025 09:42
@mdelapenya mdelapenya self-assigned this Oct 15, 2025
Copy link
Contributor

Copilot AI left a comment

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 changes the FindByID function to return a pointer to Volume instead of a Volume struct, allowing consumers to check for nil values. It also improves test resiliency by accounting for existing volumes when testing multiple volume creation.

  • Modified FindByID function signature to return *Volume instead of Volume
  • Updated error handling to return nil instead of empty structs
  • Enhanced test coverage with a "does-not-exist" test case
  • Improved test reliability by counting initial volumes before creating test volumes

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
volume/volume.find.go Changed FindByID return type from Volume to *Volume and updated error returns
volume/volume.find_test.go Added test for non-existent volume and improved multiple-volumes test reliability

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@mdelapenya mdelapenya merged commit d412165 into docker:main Oct 23, 2025
11 checks passed
@mdelapenya mdelapenya deleted the fix-find-volume-by-id branch October 23, 2025 09:48
mdelapenya added a commit to ndeloof/go-sdk that referenced this pull request Nov 6, 2025
* main:
  feat(wait): add human-readable String() methods to all wait strategies (docker#119)
  feat(image): display formatted pull progress on Windows terminals (docker#118)
  chore(release): add Go proxy refresh automation (docker#117)
  chore(release): bump module versions
  chore(release): prevent for pushing to personal forks (docker#115)
  chore(release): add pre-release checks to make the release process more consistent (docker#114)
  chore(volume): return pointer in FindByID (docker#105)
  fix(container): proper error message on empty container names (docker#113)
  fix(container): add to nil modifiers (docker#112)
  feat(container): add new functional options to add container config, hostConfig and endpointSettings (docker#111)
  feat(container): configure pull handler at container creation (docker#110)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant