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

replace directive #346

Merged
merged 11 commits into from
Jul 2, 2024
Merged

replace directive #346

merged 11 commits into from
Jul 2, 2024

Conversation

infastin
Copy link
Contributor

@infastin infastin commented Apr 28, 2024

Adds a replace directive that makes it easier to serialize foreign types.

Example usage with github.com/google/uuid
package main

import "github.com/google/uuid"

//go:generate msgp

//msgp:replace uuid.UUID with:UUID
type UUID [16]byte

// Or like that
//msgp:replace uuid.UUID with:[16]byte

type User struct {
  ID uuid.UUID
}

Also adds any to the list of primitives.

@klauspost
Copy link
Collaborator

So this will work when the type is a primitive?

LGTM, though.

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.

Please add a suite of tests. Otherwise LGTM.

@infastin
Copy link
Contributor Author

So this will work when the type is a primitive?

Should work with any type that msgp can work with.

Please add a suite of tests.

Added some tests.

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 (but pls fix tests)

@klauspost
Copy link
Collaborator

You can bump CI to 1.21 and 1.22 if that help.

@infastin
Copy link
Contributor Author

Sorry, didn't notice it was go1.18, should be fine now.

@klauspost
Copy link
Collaborator

Thanks! Giving it a bit of time to see if there are any objects before merge.

@klauspost
Copy link
Collaborator

@infastin Seems we've picked up a conflict. Could you resolve that, and I'll merge ASAP.

@infastin
Copy link
Contributor Author

infastin commented Jul 2, 2024

@klauspost Resolved.

@klauspost klauspost merged commit 2ad0d1b into tinylib:master Jul 2, 2024
4 checks passed
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
[@&#8203;bradleypeabody](https://togithub.com/bradleypeabody) in
[https://github.com/tinylib/msgp/pull/334](https://togithub.com/tinylib/msgp/pull/334)
- `replace` directive by
[@&#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
[@&#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
[@&#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 [@&#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 [@&#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
[@&#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
[@&#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
[@&#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 [@&#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
[@&#8203;eliottness](https://togithub.com/eliottness) in
[https://github.com/tinylib/msgp/pull/341](https://togithub.com/tinylib/msgp/pull/341)
- Support illumos. by [@&#8203;jperkin](https://togithub.com/jperkin) in
[https://github.com/tinylib/msgp/pull/343](https://togithub.com/tinylib/msgp/pull/343)

##### New Contributors

- [@&#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)
- [@&#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)
- [@&#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)
- [@&#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)
- [@&#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 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
[@&#8203;bradleypeabody](https://togithub.com/bradleypeabody) in
[https://github.com/tinylib/msgp/pull/334](https://togithub.com/tinylib/msgp/pull/334)
- `replace` directive by
[@&#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
[@&#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
[@&#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 [@&#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 [@&#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
[@&#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
[@&#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
[@&#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 [@&#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
[@&#8203;eliottness](https://togithub.com/eliottness) in
[https://github.com/tinylib/msgp/pull/341](https://togithub.com/tinylib/msgp/pull/341)
- Support illumos. by [@&#8203;jperkin](https://togithub.com/jperkin) in
[https://github.com/tinylib/msgp/pull/343](https://togithub.com/tinylib/msgp/pull/343)

#### New Contributors

- [@&#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)
- [@&#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)
- [@&#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)
- [@&#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)
- [@&#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]>
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants