Skip to content

Conversation

IvoGoman
Copy link
Contributor

@IvoGoman IvoGoman commented May 4, 2023

Before this change the FromCSVString would return a subset of rows in case csvReader.Read() returns an error but ignore the error itself.
E.g.

one, two, three one, two, "error"" 

The second line will result in a ErrQuote but the error is not handled. Instead the first row and no error are returned. This will then lead to undesired behavior of tests relying on this data.

The method FromCSVString already runs into a panic if the number of columns do not match. Therefore, I propose that an invalid input should run into a panic as well.

All errors returned bycsvreader.Read, besides from io.EOF, should lead to a panic, as they indicate the csv string could not properly be parsed.

@IvoGoman
Copy link
Contributor Author

IvoGoman commented May 9, 2023

@fatelei could you take a look?

@fatelei
Copy link
Collaborator

fatelei commented May 9, 2023

@fatelei could you take a look?

ok

@fatelei fatelei merged commit 3476f31 into DATA-DOG:master May 10, 2023
@IvoGoman IvoGoman deleted the fix/invalidcsvstring branch May 10, 2023 15:27
mx-psi referenced this pull request in open-telemetry/opentelemetry-collector-contrib Dec 12, 2023
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [github.com/DATA-DOG/go-sqlmock](https://togithub.com/DATA-DOG/go-sqlmock) | require | patch | `v1.5.0` -> `v1.5.1` | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>DATA-DOG/go-sqlmock (github.com/DATA-DOG/go-sqlmock)</summary> ### [`v1.5.1`](https://togithub.com/DATA-DOG/go-sqlmock/releases/tag/v1.5.1) [Compare Source](https://togithub.com/DATA-DOG/go-sqlmock/compare/v1.5.0...v1.5.1) Release was tested & verified using [aws-sqk ](https://togithub.com/aws/aws-xray-sdk-go/pull/450) ##### What's Changed - Add go 1.15 in travis by [@&#8203;gold-kou](https://togithub.com/gold-kou) in [https://github.com/DATA-DOG/go-sqlmock/pull/234](https://togithub.com/DATA-DOG/go-sqlmock/pull/234) - Update code sample by [@&#8203;ashhadsheikh](https://togithub.com/ashhadsheikh) in [https://github.com/DATA-DOG/go-sqlmock/pull/244](https://togithub.com/DATA-DOG/go-sqlmock/pull/244) - Fix ExpectedExec Stringer implementation by [@&#8203;maguro](https://togithub.com/maguro) in [https://github.com/DATA-DOG/go-sqlmock/pull/249](https://togithub.com/DATA-DOG/go-sqlmock/pull/249) - Add Multi Row Support by [@&#8203;asahasrabuddhe](https://togithub.com/asahasrabuddhe) in [https://github.com/DATA-DOG/go-sqlmock/pull/263](https://togithub.com/DATA-DOG/go-sqlmock/pull/263) - Add Go 1.16 and 1.17 to Travis by [@&#8203;gliptak](https://togithub.com/gliptak) in [https://github.com/DATA-DOG/go-sqlmock/pull/279](https://togithub.com/DATA-DOG/go-sqlmock/pull/279) - fix package by [@&#8203;col3name](https://togithub.com/col3name) in [https://github.com/DATA-DOG/go-sqlmock/pull/284](https://togithub.com/DATA-DOG/go-sqlmock/pull/284) - \[Chore]: Add Issue Template by [@&#8203;Ghvstcode](https://togithub.com/Ghvstcode) in [https://github.com/DATA-DOG/go-sqlmock/pull/289](https://togithub.com/DATA-DOG/go-sqlmock/pull/289) - Fix args passed not exp by [@&#8203;IvoGoman](https://togithub.com/IvoGoman) in [https://github.com/DATA-DOG/go-sqlmock/pull/295](https://togithub.com/DATA-DOG/go-sqlmock/pull/295) - fixes csv parse errors being silently ignored by [@&#8203;IvoGoman](https://togithub.com/IvoGoman) in [https://github.com/DATA-DOG/go-sqlmock/pull/315](https://togithub.com/DATA-DOG/go-sqlmock/pull/315) - CSVColParser: correctly set nil values in Rows by [@&#8203;IvoGoman](https://togithub.com/IvoGoman) in [https://github.com/DATA-DOG/go-sqlmock/pull/318](https://togithub.com/DATA-DOG/go-sqlmock/pull/318) - Modify: existing panic in AddRow to give a hint to the issue by [@&#8203;co60ca](https://togithub.com/co60ca) in [https://github.com/DATA-DOG/go-sqlmock/pull/326](https://togithub.com/DATA-DOG/go-sqlmock/pull/326) ##### New Contributors - [@&#8203;gold-kou](https://togithub.com/gold-kou) made their first contribution in [https://github.com/DATA-DOG/go-sqlmock/pull/234](https://togithub.com/DATA-DOG/go-sqlmock/pull/234) - [@&#8203;ashhadsheikh](https://togithub.com/ashhadsheikh) made their first contribution in [https://github.com/DATA-DOG/go-sqlmock/pull/244](https://togithub.com/DATA-DOG/go-sqlmock/pull/244) - [@&#8203;maguro](https://togithub.com/maguro) made their first contribution in [https://github.com/DATA-DOG/go-sqlmock/pull/249](https://togithub.com/DATA-DOG/go-sqlmock/pull/249) - [@&#8203;asahasrabuddhe](https://togithub.com/asahasrabuddhe) made their first contribution in [https://github.com/DATA-DOG/go-sqlmock/pull/263](https://togithub.com/DATA-DOG/go-sqlmock/pull/263) - [@&#8203;col3name](https://togithub.com/col3name) made their first contribution in [https://github.com/DATA-DOG/go-sqlmock/pull/284](https://togithub.com/DATA-DOG/go-sqlmock/pull/284) - [@&#8203;Ghvstcode](https://togithub.com/Ghvstcode) made their first contribution in [https://github.com/DATA-DOG/go-sqlmock/pull/289](https://togithub.com/DATA-DOG/go-sqlmock/pull/289) - [@&#8203;IvoGoman](https://togithub.com/IvoGoman) made their first contribution in [https://github.com/DATA-DOG/go-sqlmock/pull/295](https://togithub.com/DATA-DOG/go-sqlmock/pull/295) - [@&#8203;co60ca](https://togithub.com/co60ca) made their first contribution in [https://github.com/DATA-DOG/go-sqlmock/pull/326](https://togithub.com/DATA-DOG/go-sqlmock/pull/326) **Full Changelog**: DATA-DOG/go-sqlmock@v1.5.0...v1.5.1 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "on tuesday" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/open-telemetry/opentelemetry-collector-contrib). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy44Ny4yIiwidXBkYXRlZEluVmVyIjoiMzcuODcuMiIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==--> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: opentelemetrybot <107717825+opentelemetrybot@users.noreply.github.com>
ti-chi-bot bot referenced this pull request in PingCAP-QE/ee-apps Feb 23, 2024
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [github.com/DATA-DOG/go-sqlmock](https://togithub.com/DATA-DOG/go-sqlmock) | `v1.5.0` -> `v1.5.2` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fDATA-DOG%2fgo-sqlmock/v1.5.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fDATA-DOG%2fgo-sqlmock/v1.5.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fDATA-DOG%2fgo-sqlmock/v1.5.0/v1.5.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fDATA-DOG%2fgo-sqlmock/v1.5.0/v1.5.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>DATA-DOG/go-sqlmock (github.com/DATA-DOG/go-sqlmock)</summary> ### [`v1.5.2`](https://togithub.com/DATA-DOG/go-sqlmock/releases/tag/v1.5.2) [Compare Source](https://togithub.com/DATA-DOG/go-sqlmock/compare/v1.5.1...v1.5.2) #### What's Changed ##### Fixes breaking change from: [https://github.com/DATA-DOG/go-sqlmock/pull/295](https://togithub.com/DATA-DOG/go-sqlmock/pull/295) - fix: make no argument passed validation opt-in by [@&#8203;IvoGoman](https://togithub.com/IvoGoman) in [https://github.com/DATA-DOG/go-sqlmock/pull/329](https://togithub.com/DATA-DOG/go-sqlmock/pull/329) **Full Changelog**: DATA-DOG/go-sqlmock@v1.5.1...v1.5.2 ### [`v1.5.1`](https://togithub.com/DATA-DOG/go-sqlmock/releases/tag/v1.5.1) [Compare Source](https://togithub.com/DATA-DOG/go-sqlmock/compare/v1.5.0...v1.5.1) Release was tested & verified using [aws-sqk ](https://togithub.com/aws/aws-xray-sdk-go/pull/450) ##### What's Changed - Add go 1.15 in travis by [@&#8203;gold-kou](https://togithub.com/gold-kou) in [https://github.com/DATA-DOG/go-sqlmock/pull/234](https://togithub.com/DATA-DOG/go-sqlmock/pull/234) - Update code sample by [@&#8203;ashhadsheikh](https://togithub.com/ashhadsheikh) in [https://github.com/DATA-DOG/go-sqlmock/pull/244](https://togithub.com/DATA-DOG/go-sqlmock/pull/244) - Fix ExpectedExec Stringer implementation by [@&#8203;maguro](https://togithub.com/maguro) in [https://github.com/DATA-DOG/go-sqlmock/pull/249](https://togithub.com/DATA-DOG/go-sqlmock/pull/249) - Add Multi Row Support by [@&#8203;asahasrabuddhe](https://togithub.com/asahasrabuddhe) in [https://github.com/DATA-DOG/go-sqlmock/pull/263](https://togithub.com/DATA-DOG/go-sqlmock/pull/263) - Add Go 1.16 and 1.17 to Travis by [@&#8203;gliptak](https://togithub.com/gliptak) in [https://github.com/DATA-DOG/go-sqlmock/pull/279](https://togithub.com/DATA-DOG/go-sqlmock/pull/279) - fix package by [@&#8203;col3name](https://togithub.com/col3name) in [https://github.com/DATA-DOG/go-sqlmock/pull/284](https://togithub.com/DATA-DOG/go-sqlmock/pull/284) - \[Chore]: Add Issue Template by [@&#8203;Ghvstcode](https://togithub.com/Ghvstcode) in [https://github.com/DATA-DOG/go-sqlmock/pull/289](https://togithub.com/DATA-DOG/go-sqlmock/pull/289) - Fix args passed not exp by [@&#8203;IvoGoman](https://togithub.com/IvoGoman) in [https://github.com/DATA-DOG/go-sqlmock/pull/295](https://togithub.com/DATA-DOG/go-sqlmock/pull/295) - fixes csv parse errors being silently ignored by [@&#8203;IvoGoman](https://togithub.com/IvoGoman) in [https://github.com/DATA-DOG/go-sqlmock/pull/315](https://togithub.com/DATA-DOG/go-sqlmock/pull/315) - CSVColParser: correctly set nil values in Rows by [@&#8203;IvoGoman](https://togithub.com/IvoGoman) in [https://github.com/DATA-DOG/go-sqlmock/pull/318](https://togithub.com/DATA-DOG/go-sqlmock/pull/318) - Modify: existing panic in AddRow to give a hint to the issue by [@&#8203;co60ca](https://togithub.com/co60ca) in [https://github.com/DATA-DOG/go-sqlmock/pull/326](https://togithub.com/DATA-DOG/go-sqlmock/pull/326) ##### New Contributors - [@&#8203;gold-kou](https://togithub.com/gold-kou) made their first contribution in [https://github.com/DATA-DOG/go-sqlmock/pull/234](https://togithub.com/DATA-DOG/go-sqlmock/pull/234) - [@&#8203;ashhadsheikh](https://togithub.com/ashhadsheikh) made their first contribution in [https://github.com/DATA-DOG/go-sqlmock/pull/244](https://togithub.com/DATA-DOG/go-sqlmock/pull/244) - [@&#8203;maguro](https://togithub.com/maguro) made their first contribution in [https://github.com/DATA-DOG/go-sqlmock/pull/249](https://togithub.com/DATA-DOG/go-sqlmock/pull/249) - [@&#8203;asahasrabuddhe](https://togithub.com/asahasrabuddhe) made their first contribution in [https://github.com/DATA-DOG/go-sqlmock/pull/263](https://togithub.com/DATA-DOG/go-sqlmock/pull/263) - [@&#8203;col3name](https://togithub.com/col3name) made their first contribution in [https://github.com/DATA-DOG/go-sqlmock/pull/284](https://togithub.com/DATA-DOG/go-sqlmock/pull/284) - [@&#8203;Ghvstcode](https://togithub.com/Ghvstcode) made their first contribution in [https://github.com/DATA-DOG/go-sqlmock/pull/289](https://togithub.com/DATA-DOG/go-sqlmock/pull/289) - [@&#8203;IvoGoman](https://togithub.com/IvoGoman) made their first contribution in [https://github.com/DATA-DOG/go-sqlmock/pull/295](https://togithub.com/DATA-DOG/go-sqlmock/pull/295) - [@&#8203;co60ca](https://togithub.com/co60ca) made their first contribution in [https://github.com/DATA-DOG/go-sqlmock/pull/326](https://togithub.com/DATA-DOG/go-sqlmock/pull/326) **Full Changelog**: DATA-DOG/go-sqlmock@v1.5.0...v1.5.1 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/PingCAP-QE/ee-apps). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy44Ny4yIiwidXBkYXRlZEluVmVyIjoiMzcuMjAwLjAiLCJ0YXJnZXRCcmFuY2giOiJtYWluIn0=--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants