-
Notifications
You must be signed in to change notification settings - Fork 192
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
Fix ignored tag directives on unnamed fields #352
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
klauspost
force-pushed
the
fix-ignored-tag-fields
branch
from
July 1, 2024 11:52
c6d1582
to
d3d653c
Compare
Example: ``` type S struct { ABool bool `msg:",omitempty"` } ``` ... would ignore the omitempty, since all tags were replaced, resulting in output like: ``` // MarshalMsg implements msgp.Marshaler func (z S) MarshalMsg(b []byte) (o []byte, err error) { o = msgp.Require(b, z.Msgsize()) // map header, size 1 // string "ABool" o = append(o, 0x81, 0xa5, 0x41, 0x42, 0x6f, 0x6f, 0x6c) o = msgp.AppendBool(o, z.ABool) return } ``` Keep remaining tags when filling out the field name. Code after: ``` // MarshalMsg implements msgp.Marshaler func (z S) MarshalMsg(b []byte) (o []byte, err error) { o = msgp.Require(b, z.Msgsize()) // check for omitted fields zb0001Len := uint32(1) var zb0001Mask uint8 /* 1 bits */ _ = zb0001Mask if z.ABool == false { zb0001Len-- zb0001Mask |= 0x1 } // variable map header, size zb0001Len o = append(o, 0x80|uint8(zb0001Len)) if zb0001Len == 0 { return } if (zb0001Mask & 0x1) == 0 { // if not omitted // string "ABool" o = append(o, 0xa5, 0x41, 0x42, 0x6f, 0x6f, 0x6c) o = msgp.AppendBool(o, z.ABool) } return } ``` Regression test added.
harshavardhana
approved these changes
Jul 1, 2024
philhofer
approved these changes
Jul 2, 2024
mx-psi
referenced
this pull request
in open-telemetry/opentelemetry-collector-contrib
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://togithub.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://togithub.com/tinylib/msgp/releases/tag/v1.2.0) [Compare Source](https://togithub.com/tinylib/msgp/compare/v1.1.9...v1.2.0) ##### What's Changed - omitzero implementation by [@​bradleypeabody](https://togithub.com/bradleypeabody) in [https://github.com/tinylib/msgp/pull/334](https://togithub.com/tinylib/msgp/pull/334) - `replace` directive by [@​infastin](https://togithub.com/infastin) in [https://github.com/tinylib/msgp/pull/346](https://togithub.com/tinylib/msgp/pull/346) - Support custom struct tags by [@​very-amused](https://togithub.com/very-amused) in [https://github.com/tinylib/msgp/pull/347](https://togithub.com/tinylib/msgp/pull/347) - Add map\[string]struct{} support by [@​klauspost](https://togithub.com/klauspost) in [https://github.com/tinylib/msgp/pull/339](https://togithub.com/tinylib/msgp/pull/339) - Add `any` support by [@​VirrageS](https://togithub.com/VirrageS) in [https://github.com/tinylib/msgp/pull/350](https://togithub.com/tinylib/msgp/pull/350) - support for `any` maps in msgp.AppendIntf like in (\*Writer).WriteIntf by [@​eliottness](https://togithub.com/eliottness) in [https://github.com/tinylib/msgp/pull/340](https://togithub.com/tinylib/msgp/pull/340) - allownil: Allocate 0 length slices by [@​klauspost](https://togithub.com/klauspost) in [https://github.com/tinylib/msgp/pull/336](https://togithub.com/tinylib/msgp/pull/336) - Fix ignored tag directives on unnamed fields by [@​klauspost](https://togithub.com/klauspost) in [https://github.com/tinylib/msgp/pull/352](https://togithub.com/tinylib/msgp/pull/352) - Added `time.Duration` case to AppendIntf by [@​RiaanLaubscher](https://togithub.com/RiaanLaubscher) in [https://github.com/tinylib/msgp/pull/353](https://togithub.com/tinylib/msgp/pull/353) - Bounds checks elimination by [@​mhr3](https://togithub.com/mhr3) in [https://github.com/tinylib/msgp/pull/348](https://togithub.com/tinylib/msgp/pull/348) - test AppendIntf against ReadIntfBytes by [@​eliottness](https://togithub.com/eliottness) in [https://github.com/tinylib/msgp/pull/341](https://togithub.com/tinylib/msgp/pull/341) - Support illumos. by [@​jperkin](https://togithub.com/jperkin) in [https://github.com/tinylib/msgp/pull/343](https://togithub.com/tinylib/msgp/pull/343) ##### New Contributors - [@​eliottness](https://togithub.com/eliottness) made their first contribution in [https://github.com/tinylib/msgp/pull/340](https://togithub.com/tinylib/msgp/pull/340) - [@​jperkin](https://togithub.com/jperkin) made their first contribution in [https://github.com/tinylib/msgp/pull/343](https://togithub.com/tinylib/msgp/pull/343) - [@​very-amused](https://togithub.com/very-amused) made their first contribution in [https://github.com/tinylib/msgp/pull/347](https://togithub.com/tinylib/msgp/pull/347) - [@​RiaanLaubscher](https://togithub.com/RiaanLaubscher) made their first contribution in [https://github.com/tinylib/msgp/pull/353](https://togithub.com/tinylib/msgp/pull/353) - [@​infastin](https://togithub.com/infastin) made their first contribution in [https://github.com/tinylib/msgp/pull/346](https://togithub.com/tinylib/msgp/pull/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 <[email protected]>
codeboten
referenced
this pull request
in open-telemetry/opentelemetry-collector-contrib
Aug 27, 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://togithub.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://togithub.com/tinylib/msgp/releases/tag/v1.2.0) [Compare Source](https://togithub.com/tinylib/msgp/compare/v1.1.9...v1.2.0) #### What's Changed - omitzero implementation by [@​bradleypeabody](https://togithub.com/bradleypeabody) in [https://github.com/tinylib/msgp/pull/334](https://togithub.com/tinylib/msgp/pull/334) - `replace` directive by [@​infastin](https://togithub.com/infastin) in [https://github.com/tinylib/msgp/pull/346](https://togithub.com/tinylib/msgp/pull/346) - Support custom struct tags by [@​very-amused](https://togithub.com/very-amused) in [https://github.com/tinylib/msgp/pull/347](https://togithub.com/tinylib/msgp/pull/347) - Add map\[string]struct{} support by [@​klauspost](https://togithub.com/klauspost) in [https://github.com/tinylib/msgp/pull/339](https://togithub.com/tinylib/msgp/pull/339) - Add `any` support by [@​VirrageS](https://togithub.com/VirrageS) in [https://github.com/tinylib/msgp/pull/350](https://togithub.com/tinylib/msgp/pull/350) - support for `any` maps in msgp.AppendIntf like in (\*Writer).WriteIntf by [@​eliottness](https://togithub.com/eliottness) in [https://github.com/tinylib/msgp/pull/340](https://togithub.com/tinylib/msgp/pull/340) - allownil: Allocate 0 length slices by [@​klauspost](https://togithub.com/klauspost) in [https://github.com/tinylib/msgp/pull/336](https://togithub.com/tinylib/msgp/pull/336) - Fix ignored tag directives on unnamed fields by [@​klauspost](https://togithub.com/klauspost) in [https://github.com/tinylib/msgp/pull/352](https://togithub.com/tinylib/msgp/pull/352) - Added `time.Duration` case to AppendIntf by [@​RiaanLaubscher](https://togithub.com/RiaanLaubscher) in [https://github.com/tinylib/msgp/pull/353](https://togithub.com/tinylib/msgp/pull/353) - Bounds checks elimination by [@​mhr3](https://togithub.com/mhr3) in [https://github.com/tinylib/msgp/pull/348](https://togithub.com/tinylib/msgp/pull/348) - test AppendIntf against ReadIntfBytes by [@​eliottness](https://togithub.com/eliottness) in [https://github.com/tinylib/msgp/pull/341](https://togithub.com/tinylib/msgp/pull/341) - Support illumos. by [@​jperkin](https://togithub.com/jperkin) in [https://github.com/tinylib/msgp/pull/343](https://togithub.com/tinylib/msgp/pull/343) #### New Contributors - [@​eliottness](https://togithub.com/eliottness) made their first contribution in [https://github.com/tinylib/msgp/pull/340](https://togithub.com/tinylib/msgp/pull/340) - [@​jperkin](https://togithub.com/jperkin) made their first contribution in [https://github.com/tinylib/msgp/pull/343](https://togithub.com/tinylib/msgp/pull/343) - [@​very-amused](https://togithub.com/very-amused) made their first contribution in [https://github.com/tinylib/msgp/pull/347](https://togithub.com/tinylib/msgp/pull/347) - [@​RiaanLaubscher](https://togithub.com/RiaanLaubscher) made their first contribution in [https://github.com/tinylib/msgp/pull/353](https://togithub.com/tinylib/msgp/pull/353) - [@​infastin](https://togithub.com/infastin) made their first contribution in [https://github.com/tinylib/msgp/pull/346](https://togithub.com/tinylib/msgp/pull/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 was generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View the [repository job log](https://developer.mend.io/github/open-telemetry/opentelemetry-collector-contrib). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4yNi4xIiwidXBkYXRlZEluVmVyIjoiMzguMjYuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiZGVwZW5kZW5jaWVzIiwicmVub3ZhdGVib3QiXX0=--> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: opentelemetrybot <[email protected]> Co-authored-by: Alex Boten <[email protected]>
f7o
referenced
this pull request
in f7o/opentelemetry-collector-contrib
Sep 12, 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://togithub.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://togithub.com/tinylib/msgp/releases/tag/v1.2.0) [Compare Source](https://togithub.com/tinylib/msgp/compare/v1.1.9...v1.2.0) #### What's Changed - omitzero implementation by [@&open-telemetry#8203;bradleypeabody](https://togithub.com/bradleypeabody) in [https://github.com/tinylib/msgp/pull/334](https://togithub.com/tinylib/msgp/pull/334) - `replace` directive by [@&open-telemetry#8203;infastin](https://togithub.com/infastin) in [https://github.com/tinylib/msgp/pull/346](https://togithub.com/tinylib/msgp/pull/346) - Support custom struct tags by [@&open-telemetry#8203;very-amused](https://togithub.com/very-amused) in [https://github.com/tinylib/msgp/pull/347](https://togithub.com/tinylib/msgp/pull/347) - Add map\[string]struct{} support by [@&open-telemetry#8203;klauspost](https://togithub.com/klauspost) in [https://github.com/tinylib/msgp/pull/339](https://togithub.com/tinylib/msgp/pull/339) - Add `any` support by [@&open-telemetry#8203;VirrageS](https://togithub.com/VirrageS) in [https://github.com/tinylib/msgp/pull/350](https://togithub.com/tinylib/msgp/pull/350) - support for `any` maps in msgp.AppendIntf like in (\*Writer).WriteIntf by [@&open-telemetry#8203;eliottness](https://togithub.com/eliottness) in [https://github.com/tinylib/msgp/pull/340](https://togithub.com/tinylib/msgp/pull/340) - allownil: Allocate 0 length slices by [@&open-telemetry#8203;klauspost](https://togithub.com/klauspost) in [https://github.com/tinylib/msgp/pull/336](https://togithub.com/tinylib/msgp/pull/336) - Fix ignored tag directives on unnamed fields by [@&open-telemetry#8203;klauspost](https://togithub.com/klauspost) in [https://github.com/tinylib/msgp/pull/352](https://togithub.com/tinylib/msgp/pull/352) - Added `time.Duration` case to AppendIntf by [@&open-telemetry#8203;RiaanLaubscher](https://togithub.com/RiaanLaubscher) in [https://github.com/tinylib/msgp/pull/353](https://togithub.com/tinylib/msgp/pull/353) - Bounds checks elimination by [@&open-telemetry#8203;mhr3](https://togithub.com/mhr3) in [https://github.com/tinylib/msgp/pull/348](https://togithub.com/tinylib/msgp/pull/348) - test AppendIntf against ReadIntfBytes by [@&open-telemetry#8203;eliottness](https://togithub.com/eliottness) in [https://github.com/tinylib/msgp/pull/341](https://togithub.com/tinylib/msgp/pull/341) - Support illumos. by [@&open-telemetry#8203;jperkin](https://togithub.com/jperkin) in [https://github.com/tinylib/msgp/pull/343](https://togithub.com/tinylib/msgp/pull/343) #### New Contributors - [@&open-telemetry#8203;eliottness](https://togithub.com/eliottness) made their first contribution in [https://github.com/tinylib/msgp/pull/340](https://togithub.com/tinylib/msgp/pull/340) - [@&open-telemetry#8203;jperkin](https://togithub.com/jperkin) made their first contribution in [https://github.com/tinylib/msgp/pull/343](https://togithub.com/tinylib/msgp/pull/343) - [@&open-telemetry#8203;very-amused](https://togithub.com/very-amused) made their first contribution in [https://github.com/tinylib/msgp/pull/347](https://togithub.com/tinylib/msgp/pull/347) - [@&open-telemetry#8203;RiaanLaubscher](https://togithub.com/RiaanLaubscher) made their first contribution in [https://github.com/tinylib/msgp/pull/353](https://togithub.com/tinylib/msgp/pull/353) - [@&open-telemetry#8203;infastin](https://togithub.com/infastin) made their first contribution in [https://github.com/tinylib/msgp/pull/346](https://togithub.com/tinylib/msgp/pull/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 was generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View the [repository job log](https://developer.mend.io/github/open-telemetry/opentelemetry-collector-contrib). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4yNi4xIiwidXBkYXRlZEluVmVyIjoiMzguMjYuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiZGVwZW5kZW5jaWVzIiwicmVub3ZhdGVib3QiXX0=--> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: opentelemetrybot <[email protected]> Co-authored-by: Alex Boten <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Example:
... would ignore the
omitempty
, since all tags were replaced, resulting in output like:Keep remaining tags when filling out the field name.
Code after:
Regression test added.