Skip to content

build(deps): require and test Go 1.20 or later - #2020

Open
skitt wants to merge 1 commit into
stretchr:masterfrom
skitt:go-1.20
Open

skitt wants to merge 1 commit into
stretchr:masterfrom
skitt:go-1.20

Conversation

@skitt

@skitt skitt commented Nov 24, 2026

Copy link
Copy Markdown

Summary

This updates the required version of Go to 1.20

Changes

github.com/stretchr/objx v0.5.3 requires Go 1.20 (see https://github.com/stretchr/objx/blob/v0.5.3/go.mod), this bumps the minimum Go version to match and drops older versions from CI.

Motivation

There’s no real point in testing with versions older than 1.20 since objx expects 1.20. Given that objx doesn’t rely on any language feature newer than 1.17, 1.17-1.19 still work, so this is debatable of course. (At least, until the project bumps to Go 1.21 or later, which enforces transitive language level requirements.)

github.com/stretchr/objx v0.5.3 requires Go 1.20 (see
https://github.com/stretchr/objx/blob/v0.5.3/go.mod), this bumps the
minimum Go version to match and drops older versions from CI.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
@ccoVeille

ccoVeille commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

This is interesting. I opened this a few weeks ago

You are right that objx v0.53.0 requires Go 1.20

v0.52.0 was also expecting Go 1.20 https://github.com/stretchr/objx/blob/v0.52.0/go.mod#L3

all testify versions since v1.9.0 use objx 0.52.0 or 0.53.0

https://github.com/stretchr/testify/blob/v1.9.0/go.mod

So since February 2024 the code is the master branch of testify, Go 1.20 seems to be the minimal version because of objx.

I'm unsure why the test are passing. Maybe because Go tries anyway and objx doesn't use any feature that Go 1.17 wasn't supporting.

objx is only used in mock, so it could be isolated in a submodule maybe.

@brackendawson

@ccoVeille

Copy link
Copy Markdown
Collaborator

I've asked an agent to analyze the logic behind this.

here is the results:

Before Go 1.21, the go directive in a dependency's go.mod was only advisory rather than strictly enforced. Even though Go compiles imported packages as a whole (not just the specific symbols like objx.Map used by testify), objx v0.5.3 doesn't use any language or standard library features newer than Go 1.17, so Go 1.17-1.19 still compile and test it without error.

So I would say that it works for version between Go 1.17 and Go 1.20, so bumping Go minimal version doesn't seem necessary, and explain why it remained unnoticed.

What do you think @skitt @dolmen @brackendawson

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