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

flag: remove dependencies on shared variables #1671

Merged
merged 3 commits into from Jan 29, 2023

Conversation

zllovesuki
Copy link

What type of PR is this?

  • bug fix

What this PR does / why we need it:

Remove the dependencies of shared variable from slice type flags parsing, and instead use a separatorSpec for parsing. This should not fail downstream dependencies that may be running multiple *App concurrently with race detector on.

Which issue(s) this PR fixes:

Fixes #1670

Special notes for your reviewer:

This commit creates a new type separatorSpec that will get passed into flag parser, instead of reading from shared variables. I'm uncertain that if I may have missed some parts of the code to be injected. Please let me know if I overlooked anything.

With HideVersion and HideHelp, the integration test mentioned in the issue is now passing with race detector on with this patch applied.

Testing

Should be passing with separatorSpec, assuming that the call site has the configured separatorSpec from caller.

Release Notes

flag: remove dependencies on shared variables when parsing slices

@zllovesuki zllovesuki requested a review from a team as a code owner January 29, 2023 02:07
app.go Outdated Show resolved Hide resolved
command.go Outdated Show resolved Hide resolved
flag.go Show resolved Hide resolved
See urfave#1670 for context
This commit creates a new type separatorSpec that will get passed into
flag parser, instead of reading from shared variables.
a.separator.sep = a.SliceFlagSeparator
}

if a.DisableSliceFlagSeparator {
Copy link
Contributor

@dearchap dearchap Jan 29, 2023

Choose a reason for hiding this comment

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

if a.DisableSliceFlagSeparator {
....
} else if len(a.SliceFlagSeparator) != 0 {
...
}

Copy link
Contributor

@dearchap dearchap left a comment

Choose a reason for hiding this comment

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

Minor comments. Thanks for the PR @zllovesuki

@skelouse
Copy link
Contributor

Minor comments. Thanks for the PR @zllovesuki

Any thoughts on failing tests?

@dearchap dearchap merged commit 9013351 into urfave:v2-maint Jan 29, 2023
mudler pushed a commit to kairos-io/provider-kairos that referenced this pull request Jan 30, 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/urfave/cli/v2](https://togithub.com/urfave/cli) | require
| patch | `v2.24.1` -> `v2.24.2` |

---

### Release Notes

<details>
<summary>urfave/cli</summary>

### [`v2.24.2`](https://togithub.com/urfave/cli/releases/tag/v2.24.2)

[Compare
Source](https://togithub.com/urfave/cli/compare/v2.24.1...v2.24.2)

#### What's Changed

- Update README badges for v2 by
[@&#8203;meatballhat](https://togithub.com/meatballhat) in
[urfave/cli#1664
- Target two most recent Go versions in v2 by
[@&#8203;meatballhat](https://togithub.com/meatballhat) in
[urfave/cli#1666
- flag: remove dependencies on shared variables by
[@&#8203;zllovesuki](https://togithub.com/zllovesuki) in
[urfave/cli#1671
- Show non categorized flags with categorized on help by
[@&#8203;skelouse](https://togithub.com/skelouse) in
[urfave/cli#1673

#### New Contributors

- [@&#8203;zllovesuki](https://togithub.com/zllovesuki) made their first
contribution in
[urfave/cli#1671

**Full Changelog**:
urfave/cli@v2.24.1...v2.24.2

</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://app.renovatebot.com/dashboard#github/kairos-io/provider-kairos).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4xMDguNCIsInVwZGF0ZWRJblZlciI6IjM0LjExNi4xIn0=-->

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants