Skip to content
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

slices: update Int.Scan() to parse empty slices #791

Merged
merged 1 commit into from Nov 1, 2022

Conversation

carloruiz
Copy link
Contributor

Previously, Int.Scan() returned the non-empty slice '[0]' when reading an empty slice of ints from the database. This is a bug, as the output should also be empty. This patch fixes the bug and adds regression tests. Additionally, the code is updated to percolate up the errors from integer to string conversion, which was previously swallowed.

@carloruiz carloruiz force-pushed the int-slices-bug branch 2 times, most recently from 8277168 to 78c90fb Compare October 9, 2022 19:42
@sio4
Copy link
Member

sio4 commented Nov 1, 2022

It seems like this PR is related to #788

Copy link
Member

@sio4 sio4 left a comment

Choose a reason for hiding this comment

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

LGTM

Previously, Int.Scan() returned the slice '[0]' when reading an empty
slice of ints from the database. This is a bug, as the output should
also be empty. This patch fixes the bug and adds regression tests.
Additionally, the code is updated to percolate up the errors from
integer to string conversion, which was previously swallowed.
@sio4 sio4 linked an issue Nov 1, 2022 that may be closed by this pull request
@sio4 sio4 self-assigned this Nov 1, 2022
@sio4 sio4 added the bug Something isn't working label Nov 1, 2022
@sio4 sio4 added this to the v6.1.0 milestone Nov 1, 2022
@sio4 sio4 merged commit 7dcfd55 into gobuffalo:main Nov 1, 2022
@sio4
Copy link
Member

sio4 commented Nov 1, 2022

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Empty postgres array loaded as slice with one item
2 participants