Skip to content

cli/command/image: add go:build tag to prevent downgrading go version - #5162

Merged
thaJeztah merged 1 commit into
docker:masterfrom
thaJeztah:fix_goversion
Jun 18, 2024
Merged

cli/command/image: add go:build tag to prevent downgrading go version#5162
thaJeztah merged 1 commit into
docker:masterfrom
thaJeztah:fix_goversion

Conversation

@thaJeztah

@thaJeztahthaJeztah commented Jun 18, 2024

Copy link
Copy Markdown
Member

Before this:

make shell
make -C ./internal/gocompat/
...
GO111MODULE=on go test -v
# github.com/docker/cli/cli/command/image
../../cli/command/image/push.go:177:62: predeclared any requires go1.18 or later (-lang was set to go1.16; check go.mod)
FAIL	gocompat [build failed]
make: *** [Makefile:3: verify] Error 1
make: Leaving directory '/go/src/github.com/docker/cli/internal/gocompat'

After this patch:

make shell
make -C ./internal/gocompat/
...
GO111MODULE=on go test -v
=== RUN TestModuleCompatibllity
main_test.go:133: all packages have the correct go version specified through //go:build
--- PASS: TestModuleCompatibllity (0.00s)
PASS
ok gocompat	0.007s
make: Leaving directory '/go/src/github.com/docker/cli/internal/gocompat'

- Description for the changelog

Fix a compile error when using the CLI code as a go module

- A picture of a cute animal (not mandatory but encouraged)

Before this:
make shell
make -C ./internal/gocompat/
...
GO111MODULE=on go test -v
# github.com/docker/cli/cli/command/image
../../cli/command/image/push.go:177:62: predeclared any requires go1.18 or later (-lang was set to go1.16; check go.mod)
FAIL	gocompat [build failed]
make: *** [Makefile:3: verify] Error 1
make: Leaving directory '/go/src/github.com/docker/cli/internal/gocompat'
After this patch:
make shell
make -C ./internal/gocompat/
...
GO111MODULE=on go test -v
=== RUN TestModuleCompatibllity
main_test.go:133: all packages have the correct go version specified through //go:build
--- PASS: TestModuleCompatibllity (0.00s)
PASS
ok gocompat	0.007s
make: Leaving directory '/go/src/github.com/docker/cli/internal/gocompat'
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztahthaJeztah added this to the 27.0.0 milestone Jun 18, 2024

@gloursglours left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 61.75%. Comparing base (6904185) to head (1fd8e24).

Additional details and impacted files
@@ Coverage Diff @@## master #5162 +/- ##
==========================================
- Coverage 61.76% 61.75% -0.01% 
==========================================
Files 297 297 Lines 20768 20768 ==========================================
- Hits 12828 12826 -2 - Misses 7024 7025 +1 - Partials 916 917 +1 

@thaJeztah
thaJeztah merged commit 860a139 into docker:masterJun 18, 2024
@thaJeztah
thaJeztah deleted the fix_goversion branch June 18, 2024 10:15
@thaJeztahthaJeztah added the area/go-sdk Changes affecting the Go SDK label Jun 18, 2024
@thaJeztahthaJeztah self-assigned this Jun 18, 2024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/go-sdkChanges affecting the Go SDKkind/bugfixPR's that fix bugsstatus/2-code-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@thaJeztah@codecov-commenter@glours@vvoland