From 1fd8e2434b4c0a79dd8f86c781d59f79232e25ab Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 18 Jun 2024 11:59:39 +0200 Subject: [PATCH] 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 --- cli/command/image/push.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cli/command/image/push.go b/cli/command/image/push.go index 9b1f78784b1f..ffa6f44fac51 100644 --- a/cli/command/image/push.go +++ b/cli/command/image/push.go @@ -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 import (