Skip to content

Use strings.Fields for whitespace splitting to fix issues with strings.Split in case of multiple consecutive spaces #2006

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

Merged

Conversation

hungnguyen243
Copy link
Contributor

@hungnguyen243 hungnguyen243 commented Mar 19, 2025

Use strings.Fields for whitespace splitting to fix issues with strings.Split in case of multiple consecutive spaces

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line:

/kind api-change

/kind bug

/kind cleanup
/kind design
/kind documentation
/kind failing-test
/kind feature
/kind flake

What this PR does / why we need it:
strings.Split(s, " ") hides potential parsing bugs in case we have multiple spaces, so we're replacing it with strings.Fields(s) (https://pkg.go.dev/strings#Fields), which splits based one or more consecutive spaces.
Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Fix regex parsing issues while setting up caching

@k8s-ci-robot k8s-ci-robot added do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Mar 19, 2025
@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Mar 19, 2025
@hungnguyen243 hungnguyen243 force-pushed the fixParsingErrorListingLSSDs branch from 3c6d11a to c384662 Compare March 19, 2025 23:51
@hungnguyen243 hungnguyen243 changed the title Use strings.Fields for whitespace splitting to fix issues with string… Use strings.Fields for whitespace splitting to fix issues with strings.Split in case of multiple consecutive spaces Mar 19, 2025
…s.Split in case of multiple consecutive spaces.
@hungnguyen243 hungnguyen243 force-pushed the fixParsingErrorListingLSSDs branch from c384662 to fd0122c Compare March 20, 2025 01:10
@k8s-ci-robot
Copy link
Contributor

@hungnguyen243: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-gcp-compute-persistent-disk-csi-driver-e2e-windows-2019 fd0122c link false /test pull-gcp-compute-persistent-disk-csi-driver-e2e-windows-2019
pull-gcp-compute-persistent-disk-csi-driver-e2e-windows-2022 fd0122c link false /test pull-gcp-compute-persistent-disk-csi-driver-e2e-windows-2022

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Mar 20, 2025
@Sneha-at
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 20, 2025
@sunnylovestiramisu
Copy link
Contributor

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hungnguyen243, sunnylovestiramisu

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

The pull request process is described here

Needs approval from an approver in each of these files:

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 20, 2025
@k8s-ci-robot k8s-ci-robot merged commit c653070 into kubernetes-sigs:master Mar 20, 2025
7 of 9 checks passed
@hungnguyen243
Copy link
Contributor Author

/cherry-pick release-1.17

@k8s-infra-cherrypick-robot

@hungnguyen243: new pull request created: #2008

In response to this:

/cherry-pick release-1.17

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants