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

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

Merged
merged 1 commit into from
Jun 18, 2024

Conversation

thaJeztah
Copy link
Member

@thaJeztah thaJeztah commented Jun 18, 2024

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 <[email protected]>
@thaJeztah thaJeztah added this to the 27.0.0 milestone Jun 18, 2024
Copy link

@glours glours left a comment

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

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:master Jun 18, 2024
103 checks passed
@thaJeztah thaJeztah deleted the fix_goversion branch June 18, 2024 10:15
@thaJeztah thaJeztah added the area/go-sdk Changes affecting the Go SDK label Jun 18, 2024
@thaJeztah thaJeztah self-assigned this Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/go-sdk Changes affecting the Go SDK kind/bugfix PR's that fix bugs status/2-code-review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants