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

omitzero implementation #334

Merged
merged 1 commit into from
Oct 27, 2023
Merged

Conversation

bradleypeabody
Copy link
Contributor

Here is a PR for omitzero support, following the discussion at #326.

Highlights are:

  • omitzero is now separate from omitempty, the former emits a function call to IsZero(), and the latter checks against the Go zero value. They both use the same bitmask and other related logic, only the actual check to determine if the field should be omitted is affected. I also adjusted a few comments to reflect these changes, nothing major.
  • Overall this change of making these two separate features simplified the PR significantly, which is awesome.
  • The the name of Elem.IfZeroExpr and the fact that it is used by the omitempty feature and not by the omitzero feature is unfortunate, but I don't think a deal-breaker. Probably better to just leave it and keep it simple, rather than trying to refactor the name of IfZeroExpr to fix this minor naming oddity.
  • Since omitzero is only used for custom types, it reduced what I had in there in the way of tests - I basicaly removed all of the stuff related to primitive types since it's incompatible with IsZero(). As requested, I also added the check to ensure tuples are unaffected.

Let me know if anything else is needed for this, but hopefully that addresses all the concerns.

Copy link
Collaborator

@klauspost klauspost left a comment

Choose a reason for hiding this comment

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

LGTM

@philhofer philhofer merged commit cabc832 into tinylib:master Oct 27, 2023
4 checks passed
mx-psi pushed a commit to open-telemetry/opentelemetry-collector-contrib that referenced this pull request Jul 9, 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/tinylib/msgp](https://github.com/tinylib/msgp) |
`v1.1.9` -> `v1.2.0` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2ftinylib%2fmsgp/v1.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2ftinylib%2fmsgp/v1.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2ftinylib%2fmsgp/v1.1.9/v1.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2ftinylib%2fmsgp/v1.1.9/v1.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>tinylib/msgp (github.com/tinylib/msgp)</summary>

### [`v1.2.0`](https://github.com/tinylib/msgp/releases/tag/v1.2.0)

[Compare
Source](https://github.com/tinylib/msgp/compare/v1.1.9...v1.2.0)

##### What's Changed

- omitzero implementation by
[@&#8203;bradleypeabody](https://github.com/bradleypeabody) in
[tinylib/msgp#334
- `replace` directive by
[@&#8203;infastin](https://github.com/infastin) in
[tinylib/msgp#346
- Support custom struct tags by
[@&#8203;very-amused](https://github.com/very-amused) in
[tinylib/msgp#347
- Add map\[string]struct{} support by
[@&#8203;klauspost](https://github.com/klauspost) in
[tinylib/msgp#339
- Add `any` support by [@&#8203;VirrageS](https://github.com/VirrageS)
in
[tinylib/msgp#350
- support for `any` maps in msgp.AppendIntf like in (\*Writer).WriteIntf
by [@&#8203;eliottness](https://github.com/eliottness) in
[tinylib/msgp#340
- allownil: Allocate 0 length slices by
[@&#8203;klauspost](https://github.com/klauspost) in
[tinylib/msgp#336
- Fix ignored tag directives on unnamed fields by
[@&#8203;klauspost](https://github.com/klauspost) in
[tinylib/msgp#352
- Added `time.Duration` case to AppendIntf by
[@&#8203;RiaanLaubscher](https://github.com/RiaanLaubscher) in
[tinylib/msgp#353
- Bounds checks elimination by [@&#8203;mhr3](https://github.com/mhr3)
in
[tinylib/msgp#348
- test AppendIntf against ReadIntfBytes by
[@&#8203;eliottness](https://github.com/eliottness) in
[tinylib/msgp#341
- Support illumos. by [@&#8203;jperkin](https://github.com/jperkin) in
[tinylib/msgp#343

##### New Contributors

- [@&#8203;eliottness](https://github.com/eliottness) made their first
contribution in
[tinylib/msgp#340
- [@&#8203;jperkin](https://github.com/jperkin) made their first
contribution in
[tinylib/msgp#343
- [@&#8203;very-amused](https://github.com/very-amused) made their
first contribution in
[tinylib/msgp#347
- [@&#8203;RiaanLaubscher](https://github.com/RiaanLaubscher) made
their first contribution in
[tinylib/msgp#353
- [@&#8203;infastin](https://github.com/infastin) made their first
contribution in
[tinylib/msgp#346

**Full Changelog**:
tinylib/msgp@v1.1.9...v1.2.0

</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:eyJjcmVhdGVkSW5WZXIiOiIzNy40MjUuMSIsInVwZGF0ZWRJblZlciI6IjM3LjQyNS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJyZW5vdmF0ZWJvdCJdfQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: opentelemetrybot <107717825+opentelemetrybot@users.noreply.github.com>
cparkins pushed a commit to AmadeusITGroup/opentelemetry-collector-contrib that referenced this pull request Jul 11, 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/tinylib/msgp](https://github.com/tinylib/msgp) |
`v1.1.9` -> `v1.2.0` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2ftinylib%2fmsgp/v1.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2ftinylib%2fmsgp/v1.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2ftinylib%2fmsgp/v1.1.9/v1.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2ftinylib%2fmsgp/v1.1.9/v1.2.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>tinylib/msgp (github.com/tinylib/msgp)</summary>

### [`v1.2.0`](https://github.com/tinylib/msgp/releases/tag/v1.2.0)

[Compare
Source](https://github.com/tinylib/msgp/compare/v1.1.9...v1.2.0)

##### What's Changed

- omitzero implementation by
[@&open-telemetry#8203;bradleypeabody](https://github.com/bradleypeabody) in
[tinylib/msgp#334
- `replace` directive by
[@&open-telemetry#8203;infastin](https://github.com/infastin) in
[tinylib/msgp#346
- Support custom struct tags by
[@&open-telemetry#8203;very-amused](https://github.com/very-amused) in
[tinylib/msgp#347
- Add map\[string]struct{} support by
[@&open-telemetry#8203;klauspost](https://github.com/klauspost) in
[tinylib/msgp#339
- Add `any` support by [@&open-telemetry#8203;VirrageS](https://github.com/VirrageS)
in
[tinylib/msgp#350
- support for `any` maps in msgp.AppendIntf like in (\*Writer).WriteIntf
by [@&open-telemetry#8203;eliottness](https://github.com/eliottness) in
[tinylib/msgp#340
- allownil: Allocate 0 length slices by
[@&open-telemetry#8203;klauspost](https://github.com/klauspost) in
[tinylib/msgp#336
- Fix ignored tag directives on unnamed fields by
[@&open-telemetry#8203;klauspost](https://github.com/klauspost) in
[tinylib/msgp#352
- Added `time.Duration` case to AppendIntf by
[@&open-telemetry#8203;RiaanLaubscher](https://github.com/RiaanLaubscher) in
[tinylib/msgp#353
- Bounds checks elimination by [@&open-telemetry#8203;mhr3](https://github.com/mhr3)
in
[tinylib/msgp#348
- test AppendIntf against ReadIntfBytes by
[@&open-telemetry#8203;eliottness](https://github.com/eliottness) in
[tinylib/msgp#341
- Support illumos. by [@&open-telemetry#8203;jperkin](https://github.com/jperkin) in
[tinylib/msgp#343

##### New Contributors

- [@&open-telemetry#8203;eliottness](https://github.com/eliottness) made their first
contribution in
[tinylib/msgp#340
- [@&open-telemetry#8203;jperkin](https://github.com/jperkin) made their first
contribution in
[tinylib/msgp#343
- [@&open-telemetry#8203;very-amused](https://github.com/very-amused) made their
first contribution in
[tinylib/msgp#347
- [@&open-telemetry#8203;RiaanLaubscher](https://github.com/RiaanLaubscher) made
their first contribution in
[tinylib/msgp#353
- [@&open-telemetry#8203;infastin](https://github.com/infastin) made their first
contribution in
[tinylib/msgp#346

**Full Changelog**:
tinylib/msgp@v1.1.9...v1.2.0

</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:eyJjcmVhdGVkSW5WZXIiOiIzNy40MjUuMSIsInVwZGF0ZWRJblZlciI6IjM3LjQyNS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJyZW5vdmF0ZWJvdCJdfQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: opentelemetrybot <107717825+opentelemetrybot@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