Skip to content

chore: Bump go version to 1.22 and update dependencies - (#685) #686

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Adaendra
Copy link

🤔 What's changed?

Golang version has been updated to 1.22, breaking changes have been fixed, dependencies have been updated.

⚡️ What's your motivation?

Fixes #685

🏷️ What kind of change is this?

  • 🏦 Refactoring/debt/DX (improvement to code design, tooling, etc. without changing behaviour)

📋 Checklist:

  • I agree to respect and uphold the Cucumber Community Code of Conduct
  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • Users should know about my change
    • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

Copy link

codecov bot commented Jun 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.54%. Comparing base (153db4e) to head (27d61bb).
Report is 29 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #686      +/-   ##
==========================================
- Coverage   83.21%   78.54%   -4.67%     
==========================================
  Files          28       41      +13     
  Lines        3413     4051     +638     
==========================================
+ Hits         2840     3182     +342     
- Misses        458      753     +295     
- Partials      115      116       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@@ -8,7 +8,7 @@ jobs:
test:
strategy:
matrix:
go-version: [ 1.16.x, 1.17.x, oldstable, stable ] # Lowest supported and current stable versions.
go-version: [ 1.22.x, 1.23.x, 1.24.x, oldstable, stable ] # Lowest supported and current stable versions.
Copy link
Member

Choose a reason for hiding this comment

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

1.23 and 1.24 are already here as oldstable and stable.

I think we can migrate to a list like [<min_supported>, oldstable, stable], which would target the newest versions as main ones, but also will force backwards compatibility for users that lag behind.

I agree go1.16 feels too old to support, although I would not be terribly surprised to still find enterprise godog users still stuck at 1.16.

Let's bump minimal supported version to 1.18 (3 years old now), wdyt?

Copy link
Author

@Adaendra Adaendra Jun 29, 2025

Choose a reason for hiding this comment

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

Hi @vearutop

Noted for 1.23 and 1.24, I will remove them

About the minimum version, supporting only the 2 last versions can be hard as it changes every 6 months. So I put 1.22 as the 1.25 will come out "soon" (as I don't think a new version of godog will be out before), like this we have the 4 last versions covered.

Talking about 1.18, I understand your comment, but I prefer to keep things updated as much as possible. It's a good practice to keep their stack updated, so if enterprises want to use the new version, they will have to update their version. I will completly understand if there was a LTS version, but it's not the case.
Also I want to avoid the case where someone need to downgrade their version to be able to use a tool. (I had this case multiple times recently) So that's why it was for me a good compromise.

After if it's the project direction (to support the 6 last versions), I don't have any issue about it, and we will need to be documented to not forget about it later. ^^

Copy link
Member

Choose a reason for hiding this comment

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

It is indeed a good practice to keep tech stack up to date, however it is not always feasible for large long-living projects. Forcing such users into an upgrade is a mild violation of backwards compatibility. It may still be an okay price to pay, given there are substantial advantages and clear justification.

For example, https://github.com/rs/zerolog/blob/master/go.mod still requires go1.15, even though this library receives regular updates. That's a friendly attitude towards users.

Also I want to avoid the case where someone need to downgrade their version to be able to use a tool. (I had this case multiple times recently) So that's why it was for me a good compromise.

Could you share some context why the downgrade was needed?

Copy link
Contributor

Choose a reason for hiding this comment

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

Another aspect to consider is that Godog is an unfunded opensource project. The most important resource it has are its maintainers and contributors. Keeping the required go version somewhat recent lowers the barrier to entry for those - nobody likes working on really old stuff.

So I would suggest striking a balance. For example, the minimum required Go version could be the oldest support major Go release. That will impact users that don't keep their stack up to date. But unless they're paying for the privilege or are an active participants in the project, I don't see why that should be a problem for the participants in the Godog project.

Forcing such users into an upgrade is a mild violation of backwards compatibility. It may still be an okay price to pay, given there are substantial advantages and clear justification.

Godog is currently on major version 0, so following Semver that would allow for any breaking changes at any moment. Users should expect breaking changes inside this major. If Godog were at v1, then changing the required go version would be a breaking change that should result in a new major release.

Copy link
Author

@Adaendra Adaendra Jul 1, 2025

Choose a reason for hiding this comment

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

@vearutop

For example, https://github.com/rs/zerolog/blob/master/go.mod still requires go1.15, even though this library receives regular updates. That's a friendly attitude towards users.

I completly understand, but on the other hand, being late on the versioning makes your code at risk. Golang have CVE in the primary packages which are fixed in later versions. Also they add new features which can be helpful, so you can't take advantage of it

So clearly it's a project directive and a choice to make ^^ I don't want to force something, that's why I asked on discord , I'm open to discuss about it here and why I want to document it once decided ^^

 Could you share some context why the downgrade was needed?

Yes sure. If you have two libraries using a third one, and the third one is in "0.x.x", so you can have breaking changes in the same major version. If one of these two libraries is not updated, I might still use the old version of it and downgrade the other one.
So clearly it's an edge case for the majority. (I work with a lot of 0.x.x direct and indirect dependencies, which can explain why I encounter this issue)

Godog currently only have one dependency with a "0.x.x" version, so it should be fine ^^ But if we improve the project, add other dependencies... it can happend while this project is in "0.x.x"

And once again, if we want to keep an older version, no issues by my side. We just need someone to confirm the direction that we want to keep ^^

Copy link
Contributor

@mpkorstanje mpkorstanje left a comment

Choose a reason for hiding this comment

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

Looks good to me. Small nitpick about format strings.

@@ -42,7 +42,7 @@ func (f *Progress) Summary() {
left := math.Mod(float64(*f.Steps), float64(f.StepsPerRow))
if left != 0 {
if *f.Steps > f.StepsPerRow {
fmt.Fprintf(f.out, s(f.StepsPerRow-int(left))+fmt.Sprintf(" %d\n", *f.Steps))
fmt.Fprintf(f.out, "%s", s(f.StepsPerRow-int(left))+fmt.Sprintf(" %d\n", *f.Steps))
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make sense to replace the string concatenation with a format string like %s %d\n here?

Copy link
Author

Choose a reason for hiding this comment

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

Yes it does, I will do the change

Copy link
Author

@Adaendra Adaendra Jul 1, 2025

Choose a reason for hiding this comment

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

Note: This file has been added to test correctly the case where godog package has been vendored. As I need to stub some variables from the builder package, I needed to create a dedicated test file for it. Otherwise, I can't access these variables. (The other test file being in the builder_test package.)

@Adaendra
Copy link
Author

Adaendra commented Jul 1, 2025

codecov/project is not happy on code that I haven't added... ^^" Is it normal ?

go.mod Outdated
@@ -1,18 +1,28 @@
module github.com/cucumber/godog

go 1.16
go 1.22

require (
github.com/cucumber/gherkin/go/v26 v26.2.0

Choose a reason for hiding this comment

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

I don't think this is equivalent to the changes here: #677

Copy link
Author

Choose a reason for hiding this comment

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

Good catch, I will do the update

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.

Update go.mod versions
4 participants