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

go.mod: bump minimum language version to 1.21 #949

Merged
merged 2 commits into from
May 24, 2024
Merged

Conversation

mvdan
Copy link
Contributor

@mvdan mvdan commented May 3, 2024

(see commit message)

CI only tests Go 1.21 and 1.22, and older versions of Go are no longer
getting any bug or security fixes, so advertise that we only support
Go 1.21 or later via go.mod.

While here, ensure the module is tidy and resolve deprecation warnings,
and remove now-unnecessary Go version build tags.
@pelletier
Copy link
Owner

pelletier commented May 5, 2024

Thank you for submitting a PR!

My current stance on this is #938. In other words, I'm not fundamentally against bumping the minimum go version, but only if there is a clear benefit to it. Since it would be preventing people stuck on older versions to use the library, the trade-off needs to be appealing.

The readme advertises that only the last two versions of Go are supported, but a best effort to keep compatibility versions seem fine to me.

Is it causing any issue or preventing you to do something on your end?

@mvdan
Copy link
Contributor Author

mvdan commented May 9, 2024

Interesting - I tend to take the opposite stance, I bump go.mod as soon as my minimum supported Go version goes up. Any older Go version stops being tested in CI, so for me personally, the support is already gone. Even if the code happens to still build on a slightly older Go version, I'm not testing it, so all bets are off. It's in my opinion better to signal that via a minimum version in go.mod than to leave the users in a bit of a limbo.

Nowadays there shouldn't be an excuse to stay on an older and unsupported Go version (without security updates even), particularly given https://go.dev/doc/toolchain :)

In practical terms, yes, it would be very nice to be able to use newer std additions and generics. As master is right now, we only test on Go 1.21+, but we are not able to use any standard library APIs added after 1.16, which is contradictory.

The latter is more efficient, and allocates less, since sort.Slice
needs to go through sort.Interface which causes allocations.

    goos: linux
    goarch: amd64
    pkg: github.com/pelletier/go-toml/v2/benchmark
    cpu: AMD Ryzen 7 PRO 5850U with Radeon Graphics
                              │     old     │                new                 │
                              │   sec/op    │   sec/op     vs base               │
    Marshal/HugoFrontMatter-8   7.612µ ± 1%   6.730µ ± 1%  -11.59% (p=0.002 n=6)

                              │     old      │                 new                 │
                              │     B/s      │     B/s       vs base               │
    Marshal/HugoFrontMatter-8   65.52Mi ± 1%   74.11Mi ± 1%  +13.11% (p=0.002 n=6)

                              │     old      │                new                 │
                              │     B/op     │     B/op      vs base              │
    Marshal/HugoFrontMatter-8   5.672Ki ± 0%   5.266Ki ± 0%  -7.16% (p=0.002 n=6)

                              │    old     │                new                │
                              │ allocs/op  │ allocs/op   vs base               │
    Marshal/HugoFrontMatter-8   85.00 ± 0%   73.00 ± 0%  -14.12% (p=0.002 n=6)
@pelletier
Copy link
Owner

The performance improvement is worth the bump. Let's do it!

@pelletier pelletier merged commit 9b890cf into pelletier:v2 May 24, 2024
11 checks passed
@mvdan mvdan deleted the go-1.21 branch May 24, 2024 15:01
@pelletier pelletier changed the title go.mod: bump minimum and language to 1.21 go.mod: bump minimum language version to 1.21 Aug 23, 2024
dmathieu referenced this pull request in open-telemetry/opentelemetry-go-contrib Aug 26, 2024
…6040)

[![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/pelletier/go-toml/v2](https://github.com/pelletier/go-toml)
| `v2.2.2` -> `v2.2.3` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fpelletier%2fgo-toml%2fv2/v2.2.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fpelletier%2fgo-toml%2fv2/v2.2.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fpelletier%2fgo-toml%2fv2/v2.2.2/v2.2.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fpelletier%2fgo-toml%2fv2/v2.2.2/v2.2.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>pelletier/go-toml (github.com/pelletier/go-toml/v2)</summary>

###
[`v2.2.3`](https://github.com/pelletier/go-toml/releases/tag/v2.2.3)

[Compare
Source](https://github.com/pelletier/go-toml/compare/v2.2.2...v2.2.3)

<!-- Release notes generated using configuration in .github/release.yml
at v2.2.3 -->

#### What's Changed

##### What's new

- Allow `int`, `uint`, and `float` as map keys by
[@&#8203;daniel-weisse](https://github.com/daniel-weisse) in
[https://github.com/pelletier/go-toml/pull/958](https://github.com/pelletier/go-toml/pull/958)

##### Performance

- Remove unstable.Parser allocation when creating Decoder by
[@&#8203;mvdan](https://github.com/mvdan) in
[https://github.com/pelletier/go-toml/pull/953](https://github.com/pelletier/go-toml/pull/953)

##### Fixed bugs

- Fix reflect.Pointer backward compatibility by
[@&#8203;xxxVitoxxx](https://github.com/xxxVitoxxx) in
[https://github.com/pelletier/go-toml/pull/956](https://github.com/pelletier/go-toml/pull/956)

##### Documentation

- Fix readme typo by [@&#8203;testwill](https://github.com/testwill)
in
[https://github.com/pelletier/go-toml/pull/951](https://github.com/pelletier/go-toml/pull/951)

##### Other changes

- go.mod: bump minimum language version to 1.21 by
[@&#8203;mvdan](https://github.com/mvdan) in
[https://github.com/pelletier/go-toml/pull/949](https://github.com/pelletier/go-toml/pull/949)
- Bump testing to go 1.23 by
[@&#8203;pelletier](https://github.com/pelletier) in
[https://github.com/pelletier/go-toml/pull/961](https://github.com/pelletier/go-toml/pull/961)

#### New Contributors

- [@&#8203;mvdan](https://github.com/mvdan) made their first
contribution in
[https://github.com/pelletier/go-toml/pull/949](https://github.com/pelletier/go-toml/pull/949)
- [@&#8203;testwill](https://github.com/testwill) made their first
contribution in
[https://github.com/pelletier/go-toml/pull/951](https://github.com/pelletier/go-toml/pull/951)
- [@&#8203;xxxVitoxxx](https://github.com/xxxVitoxxx) made their first
contribution in
[https://github.com/pelletier/go-toml/pull/956](https://github.com/pelletier/go-toml/pull/956)

**Full Changelog**:
pelletier/go-toml@v2.2.2...v2.2.3

</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 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-go-contrib).

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

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.

2 participants