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

feat: nil version equality #213

Merged
merged 1 commit into from
May 14, 2024

Conversation

KnutZuidema
Copy link
Contributor

This changes the Equal method to return true for 2 nil values and false if any one of the values is nil. Previously passing a nil value would have resulted in a panic.

This changes the Equal method to return true for 2 nil values and false if any one of the values is nil. Previously passing a nil value would have resulted in a panic.
@adamperlin
Copy link

Just adding another comment in favor of this PR! I just ran into a panic when calling equal on a nil version. It would be great if this case was handled!

Copy link
Member

@mattfarina mattfarina left a comment

Choose a reason for hiding this comment

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

This flow makes sense. It's a minor optimization for some cases and it stops a panic from happening in some other places.

Note:

a := MustParse("1.2.3")
b := MustParse("1.2.3")

// a != b

To get equality with == you need...

a := MustParse("1.2.3")
b := a

// a == b

@mattfarina mattfarina merged commit 347f541 into Masterminds:master May 14, 2024
@KnutZuidema KnutZuidema deleted the feat/nil_equal branch May 15, 2024 13:39
@MikeZappa87
Copy link

@mattfarina is it possible to cut a release with this?

MrAlias pushed a commit to open-telemetry/opentelemetry-go that referenced this pull request Aug 28, 2024
…5750)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[github.com/Masterminds/semver/v3](https://github.com/Masterminds/semver)
| `v3.2.1` -> `v3.3.0` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fMasterminds%2fsemver%2fv3/v3.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fMasterminds%2fsemver%2fv3/v3.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fMasterminds%2fsemver%2fv3/v3.2.1/v3.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fMasterminds%2fsemver%2fv3/v3.2.1/v3.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>Masterminds/semver (github.com/Masterminds/semver/v3)</summary>

###
[`v3.3.0`](https://github.com/Masterminds/semver/releases/tag/v3.3.0)

[Compare
Source](https://github.com/Masterminds/semver/compare/v3.2.1...v3.3.0)

#### What's Changed

- Fix: bad package in README by
[@&#8203;sdelicata](https://github.com/sdelicata) in
[Masterminds/semver#226
- Updating the GitHub Actions and versions of Go used by
[@&#8203;mattfarina](https://github.com/mattfarina) in
[Masterminds/semver#229
- Fix spelling in README by
[@&#8203;robinschneider](https://github.com/robinschneider) in
[Masterminds/semver#222
- Adding go build cache to fuzz output by
[@&#8203;mattfarina](https://github.com/mattfarina) in
[Masterminds/semver#232
- Add caching to fuzz testing by
[@&#8203;mattfarina](https://github.com/mattfarina) in
[Masterminds/semver#234
- updating github actions by
[@&#8203;mattfarina](https://github.com/mattfarina) in
[Masterminds/semver#235
- feat: nil version equality by
[@&#8203;KnutZuidema](https://github.com/KnutZuidema) in
[Masterminds/semver#213
- add >= and <= by [@&#8203;grosser](https://github.com/grosser) in
[Masterminds/semver#238
- doc: hyphen range constraint without whitespace by
[@&#8203;johnnychen94](https://github.com/johnnychen94) in
[Masterminds/semver#216
- Removing reference to vert by
[@&#8203;mattfarina](https://github.com/mattfarina) in
[Masterminds/semver#245
- simplify StrictNewVersion by
[@&#8203;grosser](https://github.com/grosser) in
[Masterminds/semver#241
- Updating the testing version of Go used by
[@&#8203;mattfarina](https://github.com/mattfarina) in
[Masterminds/semver#246
- bumping min version in go.mod based on what's tested by
[@&#8203;mattfarina](https://github.com/mattfarina) in
[Masterminds/semver#248
- Updating changelog for 3.3.0 by
[@&#8203;mattfarina](https://github.com/mattfarina) in
[Masterminds/semver#249

#### New Contributors

- [@&#8203;sdelicata](https://github.com/sdelicata) made their first
contribution in
[Masterminds/semver#226
- [@&#8203;robinschneider](https://github.com/robinschneider) made
their first contribution in
[Masterminds/semver#222
- [@&#8203;KnutZuidema](https://github.com/KnutZuidema) made their
first contribution in
[Masterminds/semver#213
- [@&#8203;grosser](https://github.com/grosser) made their first
contribution in
[Masterminds/semver#238
- [@&#8203;johnnychen94](https://github.com/johnnychen94) made their
first contribution in
[Masterminds/semver#216

**Full Changelog**:
Masterminds/semver@v3.2.1...v3.3.0

</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 is behind base branch, 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 was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/open-telemetry/opentelemetry-go).

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

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This pull request was closed.
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.

4 participants