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

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>
This commit is contained in:
Sebastiaan van Stijn 2024-06-18 11:59:39 +02:00
parent 69041853a8
commit 1fd8e2434b
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
1 changed files with 3 additions and 0 deletions

View File

@ -1,3 +1,6 @@
// FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16:
//go:build go1.19
package image package image
import ( import (