diff --git a/cli-plugins/hooks/hook_types.go b/cli-plugins/hooks/hook_types.go index c2b0b3ba4fca..03ee7294935a 100644 --- a/cli-plugins/hooks/hook_types.go +++ b/cli-plugins/hooks/hook_types.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 // Package hooks defines the contract between the Docker CLI and CLI plugin hook // implementations. diff --git a/cli-plugins/hooks/template.go b/cli-plugins/hooks/template.go index eca5ce4f7227..99abb9acf828 100644 --- a/cli-plugins/hooks/template.go +++ b/cli-plugins/hooks/template.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package hooks diff --git a/cli-plugins/manager/error.go b/cli-plugins/manager/error.go index 6dd06405d6d7..5e66078b64a8 100644 --- a/cli-plugins/manager/error.go +++ b/cli-plugins/manager/error.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package manager diff --git a/cli-plugins/manager/hooks.go b/cli-plugins/manager/hooks.go index 9bbacb1c9c99..5a3d3ebe9191 100644 --- a/cli-plugins/manager/hooks.go +++ b/cli-plugins/manager/hooks.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package manager diff --git a/cli-plugins/manager/plugin.go b/cli-plugins/manager/plugin.go index 4270bac2ccf8..e0fe50425463 100644 --- a/cli-plugins/manager/plugin.go +++ b/cli-plugins/manager/plugin.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.26 + package manager import ( @@ -167,8 +170,7 @@ func (p *Plugin) RunHook(ctx context.Context, hookData hooks.Request) ([]byte, e out, err := pCmd.Output() if err != nil { - var exitErr *exec.ExitError - if errors.As(err, &exitErr) { + if _, ok := errors.AsType[*exec.ExitError](err); ok { return nil, wrapAsPluginError(err, "plugin hook subcommand exited unsuccessfully") } return nil, wrapAsPluginError(err, "failed to execute plugin hook subcommand: "+pCmd.String()) diff --git a/cli-plugins/plugin/plugin.go b/cli-plugins/plugin/plugin.go index 58ee3b876287..a90e4b6f6cbe 100644 --- a/cli-plugins/plugin/plugin.go +++ b/cli-plugins/plugin/plugin.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.26 + package plugin import ( @@ -97,8 +100,7 @@ func Run(makeCmd func(command.Cli) *cobra.Command, meta metadata.Metadata, ops . plugin := makeCmd(dockerCLI) if err := RunPlugin(dockerCLI, plugin, meta); err != nil { - var stErr cli.StatusError - if errors.As(err, &stErr) { + if stErr, ok := errors.AsType[cli.StatusError](err); ok { // StatusError should only be used for errors, and all errors should // have a non-zero exit status, so never exit with 0 if stErr.StatusCode == 0 { // FIXME(thaJeztah): this should never be used with a zero status-code. Check if we do this anywhere. diff --git a/cli/command/cli.go b/cli/command/cli.go index eb69b3eb73fc..f7f428b11b05 100644 --- a/cli/command/cli.go +++ b/cli/command/cli.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package command diff --git a/cli/command/config/formatter.go b/cli/command/config/formatter.go index 8e0b296df710..9453dec77e76 100644 --- a/cli/command/config/formatter.go +++ b/cli/command/config/formatter.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package config diff --git a/cli/command/config/inspect.go b/cli/command/config/inspect.go index 1991922ed8c3..a7ac66290031 100644 --- a/cli/command/config/inspect.go +++ b/cli/command/config/inspect.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package config diff --git a/cli/command/container/completion.go b/cli/command/container/completion.go index 7d4940ad26d5..97d32728fa84 100644 --- a/cli/command/container/completion.go +++ b/cli/command/container/completion.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package container diff --git a/cli/command/container/inspect.go b/cli/command/container/inspect.go index df01341955bc..9ebd45016cbf 100644 --- a/cli/command/container/inspect.go +++ b/cli/command/container/inspect.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package container diff --git a/cli/command/container/opts.go b/cli/command/container/opts.go index 1af0b64546a4..680a84a8b56c 100644 --- a/cli/command/container/opts.go +++ b/cli/command/container/opts.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package container diff --git a/cli/command/container/start.go b/cli/command/container/start.go index 916f5808d717..f6cdd0c211f6 100644 --- a/cli/command/container/start.go +++ b/cli/command/container/start.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.26 + package container import ( @@ -169,8 +172,7 @@ func RunStart(ctx context.Context, dockerCli command.Cli, opts *StartOptions) er } } if attachErr := <-cErr; attachErr != nil { - var escapeError term.EscapeError - if errors.As(attachErr, &escapeError) { + if _, ok := errors.AsType[term.EscapeError](attachErr); ok { // The user entered the detach escape sequence. return nil } diff --git a/cli/command/container/stats.go b/cli/command/container/stats.go index 9d4bfce51bff..c0370f95e5f2 100644 --- a/cli/command/container/stats.go +++ b/cli/command/container/stats.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package container diff --git a/cli/command/container/tty.go b/cli/command/container/tty.go index 3bf03a990678..bdb4308bdc91 100644 --- a/cli/command/container/tty.go +++ b/cli/command/container/tty.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package container diff --git a/cli/command/context.go b/cli/command/context.go index b876e225ef43..153b046f5769 100644 --- a/cli/command/context.go +++ b/cli/command/context.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package command diff --git a/cli/command/context/completion.go b/cli/command/context/completion.go index aba7d5b74b55..f5ea6ad30ccb 100644 --- a/cli/command/context/completion.go +++ b/cli/command/context/completion.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package context diff --git a/cli/command/context/create.go b/cli/command/context/create.go index f7e62205ba21..81e4418939b5 100644 --- a/cli/command/context/create.go +++ b/cli/command/context/create.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package context diff --git a/cli/command/context/create_test.go b/cli/command/context/create_test.go index a9d64e1248be..4dc62b215feb 100644 --- a/cli/command/context/create_test.go +++ b/cli/command/context/create_test.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package context diff --git a/cli/command/context/inspect.go b/cli/command/context/inspect.go index 4e9ab2822202..be1300f0a8e9 100644 --- a/cli/command/context/inspect.go +++ b/cli/command/context/inspect.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package context diff --git a/cli/command/context/list.go b/cli/command/context/list.go index d0236d814f65..67e9b9c66011 100644 --- a/cli/command/context/list.go +++ b/cli/command/context/list.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package context diff --git a/cli/command/context/options.go b/cli/command/context/options.go index 429f47cc4139..979b6927363b 100644 --- a/cli/command/context/options.go +++ b/cli/command/context/options.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.26 + package context import ( @@ -69,8 +72,7 @@ func parseBool(config map[string]string, name string) (bool, error) { } res, err := strconv.ParseBool(strVal) if err != nil { - var nErr *strconv.NumError - if errors.As(err, &nErr) { + if nErr, ok := errors.AsType[*strconv.NumError](err); ok { return res, fmt.Errorf("%s: parsing %q: %w", name, nErr.Num, nErr.Err) } return res, fmt.Errorf("%s: %w", name, err) diff --git a/cli/command/context_test.go b/cli/command/context_test.go index 421102d242a1..993d79a92e9b 100644 --- a/cli/command/context_test.go +++ b/cli/command/context_test.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package command diff --git a/cli/command/defaultcontextstore.go b/cli/command/defaultcontextstore.go index 54ca58d2d8d4..90be220155a3 100644 --- a/cli/command/defaultcontextstore.go +++ b/cli/command/defaultcontextstore.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package command diff --git a/cli/command/defaultcontextstore_test.go b/cli/command/defaultcontextstore_test.go index 6a4f0866f2b7..3a7ef5a38405 100644 --- a/cli/command/defaultcontextstore_test.go +++ b/cli/command/defaultcontextstore_test.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package command diff --git a/cli/command/formatter/container.go b/cli/command/formatter/container.go index a282921a5110..b65209c26c89 100644 --- a/cli/command/formatter/container.go +++ b/cli/command/formatter/container.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package formatter diff --git a/cli/command/formatter/container_test.go b/cli/command/formatter/container_test.go index 6941d262013a..07df93d9aeed 100644 --- a/cli/command/formatter/container_test.go +++ b/cli/command/formatter/container_test.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package formatter diff --git a/cli/command/formatter/custom.go b/cli/command/formatter/custom.go index b845e191fa20..80a716230b99 100644 --- a/cli/command/formatter/custom.go +++ b/cli/command/formatter/custom.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package formatter diff --git a/cli/command/formatter/displayutils.go b/cli/command/formatter/displayutils.go index ef008006ffb6..d17b432633f5 100644 --- a/cli/command/formatter/displayutils.go +++ b/cli/command/formatter/displayutils.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package formatter diff --git a/cli/command/formatter/formatter.go b/cli/command/formatter/formatter.go index 01c7867f31be..4beb7f56b256 100644 --- a/cli/command/formatter/formatter.go +++ b/cli/command/formatter/formatter.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package formatter diff --git a/cli/command/formatter/formatter_test.go b/cli/command/formatter/formatter_test.go index d07d529a8da5..0c1675417de8 100644 --- a/cli/command/formatter/formatter_test.go +++ b/cli/command/formatter/formatter_test.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package formatter diff --git a/cli/command/formatter/reflect.go b/cli/command/formatter/reflect.go index 150c01805a1d..bb17584209c0 100644 --- a/cli/command/formatter/reflect.go +++ b/cli/command/formatter/reflect.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package formatter diff --git a/cli/command/formatter/reflect_test.go b/cli/command/formatter/reflect_test.go index fdff3f58994e..3e1e4405a6fb 100644 --- a/cli/command/formatter/reflect_test.go +++ b/cli/command/formatter/reflect_test.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package formatter diff --git a/cli/command/formatter/volume.go b/cli/command/formatter/volume.go index 75b6ad007f94..d55d3677cb77 100644 --- a/cli/command/formatter/volume.go +++ b/cli/command/formatter/volume.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package formatter diff --git a/cli/command/formatter/volume_test.go b/cli/command/formatter/volume_test.go index b85a75c387c8..bcb4227c24c0 100644 --- a/cli/command/formatter/volume_test.go +++ b/cli/command/formatter/volume_test.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package formatter diff --git a/cli/command/idresolver/idresolver.go b/cli/command/idresolver/idresolver.go index 95e334535eb6..2ee6d2c88eee 100644 --- a/cli/command/idresolver/idresolver.go +++ b/cli/command/idresolver/idresolver.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package idresolver diff --git a/cli/command/image/build.go b/cli/command/image/build.go index db33e0e7c64d..26a873985429 100644 --- a/cli/command/image/build.go +++ b/cli/command/image/build.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.26 + package image import ( @@ -364,8 +367,7 @@ func runBuild(ctx context.Context, dockerCli command.Cli, options buildOptions) err = jsonstream.Display(ctx, response.Body, streams.NewOut(buildBuff), jsonstream.WithAuxCallback(aux)) if err != nil { - var jerr *jsonstream.JSONError - if errors.As(err, &jerr) { + if jerr, ok := errors.AsType[*jsonstream.JSONError](err); ok { // If no error code is set, default to 1 if jerr.Code == 0 { jerr.Code = 1 diff --git a/cli/command/image/inspect.go b/cli/command/image/inspect.go index 714c7c738440..8304740866e0 100644 --- a/cli/command/image/inspect.go +++ b/cli/command/image/inspect.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package image diff --git a/cli/command/image/list.go b/cli/command/image/list.go index 59b639668c6d..626f06cb84eb 100644 --- a/cli/command/image/list.go +++ b/cli/command/image/list.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package image diff --git a/cli/command/image/push.go b/cli/command/image/push.go index 78ee48d664b0..87e2f7dea4c4 100644 --- a/cli/command/image/push.go +++ b/cli/command/image/push.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package image diff --git a/cli/command/image/tree.go b/cli/command/image/tree.go index 31645ac2363e..cd053c2f4bb1 100644 --- a/cli/command/image/tree.go +++ b/cli/command/image/tree.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package image diff --git a/cli/command/inspect/inspector.go b/cli/command/inspect/inspector.go index 63e7b597ba53..1f154c088ffa 100644 --- a/cli/command/inspect/inspector.go +++ b/cli/command/inspect/inspector.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package inspect diff --git a/cli/command/manifest/annotate.go b/cli/command/manifest/annotate.go index 231aa930621f..a9507deb73f0 100644 --- a/cli/command/manifest/annotate.go +++ b/cli/command/manifest/annotate.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package manifest diff --git a/cli/command/network/create_test.go b/cli/command/network/create_test.go index 7de25edb63fa..dc5505023a78 100644 --- a/cli/command/network/create_test.go +++ b/cli/command/network/create_test.go @@ -189,8 +189,6 @@ func TestNetworkCreateWithFlags(t *testing.T) { // TestNetworkCreateIPv4 verifies behavior of the "--ipv4" option. This option // is an optional bool, and must default to "nil", not "true" or "false". func TestNetworkCreateIPv4(t *testing.T) { - boolPtr := func(val bool) *bool { return &val } - tests := []struct { doc, name string flags []string @@ -205,19 +203,19 @@ func TestNetworkCreateIPv4(t *testing.T) { doc: "IPv4 enabled", name: "ipv4-enabled", flags: []string{"--ipv4=true"}, - expected: boolPtr(true), + expected: new(true), }, { doc: "IPv4 enabled (shorthand)", name: "ipv4-enabled-shorthand", flags: []string{"--ipv4"}, - expected: boolPtr(true), + expected: new(true), }, { doc: "IPv4 disabled", name: "ipv4-disabled", flags: []string{"--ipv4=false"}, - expected: boolPtr(false), + expected: new(false), }, } @@ -243,8 +241,6 @@ func TestNetworkCreateIPv4(t *testing.T) { // TestNetworkCreateIPv6 verifies behavior of the "--ipv6" option. This option // is an optional bool, and must default to "nil", not "true" or "false". func TestNetworkCreateIPv6(t *testing.T) { - strPtr := func(val bool) *bool { return &val } - tests := []struct { doc, name string flags []string @@ -259,19 +255,19 @@ func TestNetworkCreateIPv6(t *testing.T) { doc: "IPV6 enabled", name: "ipv6-enabled", flags: []string{"--ipv6=true"}, - expected: strPtr(true), + expected: new(true), }, { doc: "IPV6 enabled (shorthand)", name: "ipv6-enabled-shorthand", flags: []string{"--ipv6"}, - expected: strPtr(true), + expected: new(true), }, { doc: "IPV6 disabled", name: "ipv6-disabled", flags: []string{"--ipv6=false"}, - expected: strPtr(false), + expected: new(false), }, } diff --git a/cli/command/network/formatter.go b/cli/command/network/formatter.go index cbc72a7fca2d..574de2d5f2cf 100644 --- a/cli/command/network/formatter.go +++ b/cli/command/network/formatter.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package network diff --git a/cli/command/network/formatter_test.go b/cli/command/network/formatter_test.go index 8a9635aefb05..6e870373feec 100644 --- a/cli/command/network/formatter_test.go +++ b/cli/command/network/formatter_test.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package network diff --git a/cli/command/network/inspect.go b/cli/command/network/inspect.go index 77f55d6535b1..1c27650f0c2b 100644 --- a/cli/command/network/inspect.go +++ b/cli/command/network/inspect.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package network diff --git a/cli/command/node/formatter_test.go b/cli/command/node/formatter_test.go index bd378806ba7d..a496fafec9a9 100644 --- a/cli/command/node/formatter_test.go +++ b/cli/command/node/formatter_test.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package node diff --git a/cli/command/node/inspect.go b/cli/command/node/inspect.go index 9ae166f30ba5..1020c0eaf940 100644 --- a/cli/command/node/inspect.go +++ b/cli/command/node/inspect.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package node diff --git a/cli/command/node/update.go b/cli/command/node/update.go index 542152895ce3..a5f70e027430 100644 --- a/cli/command/node/update.go +++ b/cli/command/node/update.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package node diff --git a/cli/command/plugin/formatter_test.go b/cli/command/plugin/formatter_test.go index b0098f308d76..3c8584605419 100644 --- a/cli/command/plugin/formatter_test.go +++ b/cli/command/plugin/formatter_test.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package plugin diff --git a/cli/command/plugin/inspect.go b/cli/command/plugin/inspect.go index 1b6ec03a6a8c..ed45605dc137 100644 --- a/cli/command/plugin/inspect.go +++ b/cli/command/plugin/inspect.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package plugin diff --git a/cli/command/secret/formatter.go b/cli/command/secret/formatter.go index bc7129960f06..9788f1ce1ecc 100644 --- a/cli/command/secret/formatter.go +++ b/cli/command/secret/formatter.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package secret diff --git a/cli/command/secret/inspect.go b/cli/command/secret/inspect.go index 165645f1923a..6f614c3d3015 100644 --- a/cli/command/secret/inspect.go +++ b/cli/command/secret/inspect.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package secret diff --git a/cli/command/service/formatter_test.go b/cli/command/service/formatter_test.go index 4ff8b1718675..024c827ec806 100644 --- a/cli/command/service/formatter_test.go +++ b/cli/command/service/formatter_test.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package service diff --git a/cli/command/service/inspect.go b/cli/command/service/inspect.go index 6ec3a3974b8a..7e56b317c846 100644 --- a/cli/command/service/inspect.go +++ b/cli/command/service/inspect.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package service diff --git a/cli/command/service/inspect_test.go b/cli/command/service/inspect_test.go index 24981ed2f4a1..2155934cc466 100644 --- a/cli/command/service/inspect_test.go +++ b/cli/command/service/inspect_test.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package service diff --git a/cli/command/service/internal/genericresource/parse.go b/cli/command/service/internal/genericresource/parse.go index 37305fee2b91..9cbaa997af4a 100644 --- a/cli/command/service/internal/genericresource/parse.go +++ b/cli/command/service/internal/genericresource/parse.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 // Package genericresource is a local fork of SwarmKit's [genericresource] package, // without protobuf dependencies. diff --git a/cli/command/service/opts.go b/cli/command/service/opts.go index da83f8108498..e04f392e46b2 100644 --- a/cli/command/service/opts.go +++ b/cli/command/service/opts.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package service diff --git a/cli/command/service/progress/progress.go b/cli/command/service/progress/progress.go index 36f5d19e465a..ef191fce33ac 100644 --- a/cli/command/service/progress/progress.go +++ b/cli/command/service/progress/progress.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package progress diff --git a/cli/command/service/update.go b/cli/command/service/update.go index 13af4bd746cf..7520b0889103 100644 --- a/cli/command/service/update.go +++ b/cli/command/service/update.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package service diff --git a/cli/command/stack/loader.go b/cli/command/stack/loader.go index 60107f7f17ae..49366e4d50cc 100644 --- a/cli/command/stack/loader.go +++ b/cli/command/stack/loader.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package stack @@ -29,8 +29,7 @@ func loadComposeFile(streams command.Streams, opts deployOptions) (*composetypes config, err := loader.Load(configDetails) if err != nil { - var fpe *loader.ForbiddenPropertiesError - if errors.As(err, &fpe) { + if fpe, ok := errors.AsType[*loader.ForbiddenPropertiesError](err); ok { // this error is intentionally formatted multi-line return nil, fmt.Errorf("compose file contains unsupported options:\n\n%s\n", propertyWarnings(fpe.Properties)) //nolint:staticcheck // ignore ST1005 } diff --git a/cli/command/system/info.go b/cli/command/system/info.go index 5ae650a17c6a..80a21629ec6e 100644 --- a/cli/command/system/info.go +++ b/cli/command/system/info.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package system diff --git a/cli/command/system/inspect.go b/cli/command/system/inspect.go index 76cb4faaae9a..1912400068ce 100644 --- a/cli/command/system/inspect.go +++ b/cli/command/system/inspect.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package system diff --git a/cli/command/system/prune.go b/cli/command/system/prune.go index accbb8558ddc..698b6d1bb365 100644 --- a/cli/command/system/prune.go +++ b/cli/command/system/prune.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package system diff --git a/cli/command/system/pruner/pruner.go b/cli/command/system/pruner/pruner.go index ab744c1adcd5..1ff393c5f083 100644 --- a/cli/command/system/pruner/pruner.go +++ b/cli/command/system/pruner/pruner.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 // Package pruner registers "prune" functions to be included as part of // "docker system prune". diff --git a/cli/command/system/version.go b/cli/command/system/version.go index 698fb70917f1..b385ef7181d6 100644 --- a/cli/command/system/version.go +++ b/cli/command/system/version.go @@ -87,7 +87,7 @@ type clientVersion struct { // serverVersion contains information about the Docker server host. // it's the client-side presentation of [client.ServerVersionResult]. type serverVersion struct { - Platform client.PlatformInfo `json:",omitempty"` // Platform is the platform (product name) the server is running on. + Platform client.PlatformInfo `json:"Platform"` // Platform is the platform (product name) the server is running on. Version string `json:"Version"` // Version is the version of the daemon. APIVersion string `json:"ApiVersion"` // APIVersion is the highest API version supported by the server. MinAPIVersion string `json:"MinAPIVersion,omitempty"` // MinAPIVersion is the minimum API version the server supports. diff --git a/cli/command/telemetry_docker.go b/cli/command/telemetry_docker.go index 0cd37b3a1cb7..b262e62e2197 100644 --- a/cli/command/telemetry_docker.go +++ b/cli/command/telemetry_docker.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package command diff --git a/cli/command/utils.go b/cli/command/utils.go index bf7638f37b3c..1bee68cec5de 100644 --- a/cli/command/utils.go +++ b/cli/command/utils.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package command diff --git a/cli/command/volume/create.go b/cli/command/volume/create.go index dacd382d2f7f..5c2098e03519 100644 --- a/cli/command/volume/create.go +++ b/cli/command/volume/create.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package volume diff --git a/cli/command/volume/create_test.go b/cli/command/volume/create_test.go index 8992950951ef..7f8a2c387c6a 100644 --- a/cli/command/volume/create_test.go +++ b/cli/command/volume/create_test.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package volume diff --git a/cli/command/volume/inspect.go b/cli/command/volume/inspect.go index 54a9f63ca9d0..98c1d784750e 100644 --- a/cli/command/volume/inspect.go +++ b/cli/command/volume/inspect.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package volume diff --git a/cli/compose/convert/service.go b/cli/compose/convert/service.go index cc04bc357a42..762bf144ffdf 100644 --- a/cli/compose/convert/service.go +++ b/cli/compose/convert/service.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package convert @@ -399,7 +399,7 @@ func convertFileObject( } mode := config.Mode if mode == nil { - mode = uint32Ptr(0o444) + mode = new(uint32(0o444)) } return swarmReferenceObject{ @@ -413,10 +413,6 @@ func convertFileObject( }, nil } -func uint32Ptr(value uint32) *uint32 { - return &value -} - // convertExtraHosts converts : mappings to SwarmKit notation: // "IP-address hostname(s)". The original order of mappings is preserved. func convertExtraHosts(extraHosts composetypes.HostsList) []string { @@ -501,8 +497,7 @@ func convertRestartPolicy(restart string, restartPolicy *composetypes.RestartPol if i <= 0 { return nil } - p := uint64(i) - return &p + return new(uint64(i)) } switch policy.Name { @@ -529,7 +524,7 @@ func convertUpdateConfig(source *composetypes.UpdateConfig) *swarm.UpdateConfig if source == nil { return nil } - parallel := uint64(1) + var parallel uint64 = 1 if source.Parallelism != nil { parallel = *source.Parallelism } diff --git a/cli/compose/convert/service_test.go b/cli/compose/convert/service_test.go index 2ef349e731cf..7cd4db46e64b 100644 --- a/cli/compose/convert/service_test.go +++ b/cli/compose/convert/service_test.go @@ -66,14 +66,10 @@ func TestConvertRestartPolicy(t *testing.T) { } } -func strPtr(val string) *string { - return &val -} - func TestConvertEnvironment(t *testing.T) { source := map[string]*string{ - "foo": strPtr("bar"), - "key": strPtr("value"), + "foo": new("bar"), + "key": new("value"), } env := convertEnvironment(source) assert.Check(t, is.DeepEqual([]string{"foo=bar", "key=value"}, env)) @@ -81,7 +77,7 @@ func TestConvertEnvironment(t *testing.T) { func TestConvertEnvironmentWhenNilValueExists(t *testing.T) { source := map[string]*string{ - "key": strPtr("value"), + "key": new("value"), "keyWithNoValue": nil, } env := convertEnvironment(source) @@ -466,7 +462,7 @@ func TestConvertFileObject(t *testing.T) { Target: "target", UID: "user", GID: "group", - Mode: uint32Ptr(0o644), + Mode: new(uint32(0o644)), } swarmRef, err := convertFileObject(namespace, config, lookupConfig) assert.NilError(t, err) diff --git a/cli/compose/interpolation/interpolation.go b/cli/compose/interpolation/interpolation.go index 0965b436cf36..78dcde79cdc3 100644 --- a/cli/compose/interpolation/interpolation.go +++ b/cli/compose/interpolation/interpolation.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package interpolation diff --git a/cli/compose/interpolation/interpolation_test.go b/cli/compose/interpolation/interpolation_test.go index 24018245190d..a5538836e3f4 100644 --- a/cli/compose/interpolation/interpolation_test.go +++ b/cli/compose/interpolation/interpolation_test.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package interpolation diff --git a/cli/compose/loader/full-struct_test.go b/cli/compose/loader/full-struct_test.go index 62defa9cc3ca..9a6e7a76d308 100644 --- a/cli/compose/loader/full-struct_test.go +++ b/cli/compose/loader/full-struct_test.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package loader @@ -36,7 +36,7 @@ func services(workingDir, homeDir string) []types.ServiceConfig { Build: types.BuildConfig{ Context: "./dir", Dockerfile: "Dockerfile", - Args: map[string]*string{"foo": strPtr("bar")}, + Args: map[string]*string{"foo": new("bar")}, Target: "foo", Network: "foo", CacheFrom: []string{"foo", "bar"}, @@ -59,17 +59,17 @@ func services(workingDir, homeDir string) []types.ServiceConfig { Target: "/my_config", UID: "103", GID: "103", - Mode: uint32Ptr(0o440), + Mode: new(uint32(0o440)), }, }, ContainerName: "my-web-container", DependsOn: []string{"db", "redis"}, Deploy: types.DeployConfig{ Mode: "replicated", - Replicas: uint64Ptr(6), + Replicas: new(uint64(6)), Labels: map[string]string{"FOO": "BAR"}, RollbackConfig: &types.UpdateConfig{ - Parallelism: uint64Ptr(3), + Parallelism: new(uint64(3)), Delay: types.Duration(10 * time.Second), FailureAction: "continue", Monitor: types.Duration(60 * time.Second), @@ -77,7 +77,7 @@ func services(workingDir, homeDir string) []types.ServiceConfig { Order: "start-first", }, UpdateConfig: &types.UpdateConfig{ - Parallelism: uint64Ptr(3), + Parallelism: new(uint64(3)), Delay: types.Duration(10 * time.Second), FailureAction: "continue", Monitor: types.Duration(60 * time.Second), @@ -111,9 +111,9 @@ func services(workingDir, homeDir string) []types.ServiceConfig { }, RestartPolicy: &types.RestartPolicy{ Condition: "on-failure", - Delay: durationPtr(5 * time.Second), - MaxAttempts: uint64Ptr(3), - Window: durationPtr(2 * time.Minute), + Delay: new(types.Duration(5 * time.Second)), + MaxAttempts: new(uint64(3)), + Window: new(types.Duration(2 * time.Minute)), }, Placement: types.Placement{ Constraints: []string{"node=foo"}, @@ -132,10 +132,10 @@ func services(workingDir, homeDir string) []types.ServiceConfig { DomainName: "foo.com", Entrypoint: []string{"/code/entrypoint.sh", "-p", "3000"}, Environment: map[string]*string{ - "FOO": strPtr("foo_from_env_file"), - "BAR": strPtr("bar_from_env_file_2"), - "BAZ": strPtr("baz_from_service_def"), - "QUX": strPtr("qux_from_environment"), + "FOO": new("foo_from_env_file"), + "BAR": new("bar_from_env_file_2"), + "BAZ": new("baz_from_service_def"), + "QUX": new("qux_from_environment"), }, EnvFile: []string{ "./example1.env", @@ -158,11 +158,11 @@ func services(workingDir, homeDir string) []types.ServiceConfig { }, HealthCheck: &types.HealthCheckConfig{ Test: types.HealthCheckTest([]string{"CMD-SHELL", "echo \"hello world\""}), - Interval: durationPtr(10 * time.Second), - Timeout: durationPtr(1 * time.Second), - Retries: uint64Ptr(5), - StartPeriod: durationPtr(15 * time.Second), - StartInterval: durationPtr(1 * time.Second), + Interval: new(types.Duration(10 * time.Second)), + Timeout: new(types.Duration(1 * time.Second)), + Retries: new(uint64(5)), + StartPeriod: new(types.Duration(15 * time.Second)), + StartInterval: new(types.Duration(1 * time.Second)), }, Hostname: "foo", Image: "redis", @@ -348,7 +348,7 @@ func services(workingDir, homeDir string) []types.ServiceConfig { Target: "my_secret", UID: "103", GID: "103", - Mode: uint32Ptr(0o440), + Mode: new(uint32(0o440)), }, }, SecurityOpt: []string{ @@ -357,7 +357,7 @@ func services(workingDir, homeDir string) []types.ServiceConfig { }, StdinOpen: true, StopSignal: "SIGUSR1", - StopGracePeriod: durationPtr(20 * time.Second), + StopGracePeriod: new(types.Duration(20 * time.Second)), Sysctls: map[string]string{ "net.core.somaxconn": "1024", "net.ipv4.tcp_syncookies": "0", diff --git a/cli/compose/loader/interpolate.go b/cli/compose/loader/interpolate.go index 3eee05679e78..11c44113d451 100644 --- a/cli/compose/loader/interpolate.go +++ b/cli/compose/loader/interpolate.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package loader diff --git a/cli/compose/loader/loader.go b/cli/compose/loader/loader.go index 0ddebce78543..91d85cfd0a43 100644 --- a/cli/compose/loader/loader.go +++ b/cli/compose/loader/loader.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package loader diff --git a/cli/compose/loader/loader_test.go b/cli/compose/loader/loader_test.go index 549d02ed73a5..1b97ffaf2d2b 100644 --- a/cli/compose/loader/loader_test.go +++ b/cli/compose/loader/loader_test.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package loader @@ -9,7 +9,6 @@ import ( "runtime" "sort" "testing" - "time" "github.com/docker/cli/cli/compose/types" "github.com/google/go-cmp/cmp/cmpopts" @@ -179,10 +178,6 @@ var samplePortsConfig = []types.ServicePortConfig{ }, } -func strPtr(val string) *string { - return &val -} - var sampleConfig = types.Config{ Version: "3.13", Services: []types.ServiceConfig{ @@ -197,7 +192,7 @@ var sampleConfig = types.Config{ { Name: "bar", Image: "busybox", - Environment: map[string]*string{"FOO": strPtr("1")}, + Environment: map[string]*string{"FOO": new("1")}, Networks: map[string]*types.ServiceNetworkConfig{ "with_ipam": nil, }, @@ -530,10 +525,10 @@ services: assert.NilError(t, err) expected := types.MappingWithEquals{ - "FOO": strPtr("1"), - "BAR": strPtr("2"), - "BAZ": strPtr("2.5"), - "QUX": strPtr("qux"), + "FOO": new("1"), + "BAR": new("2"), + "BAZ": new("2.5"), + "QUX": new("qux"), "QUUX": nil, } @@ -685,31 +680,31 @@ networks: Configs: []types.ServiceConfigObjConfig{ { Source: "appconfig", - Mode: uint32Ptr(555), + Mode: new(uint32(555)), }, }, Secrets: []types.ServiceSecretConfig{ { Source: "super", - Mode: uint32Ptr(555), + Mode: new(uint32(555)), }, }, HealthCheck: &types.HealthCheckConfig{ - Retries: uint64Ptr(555), + Retries: new(uint64(555)), Disable: true, }, Deploy: types.DeployConfig{ - Replicas: uint64Ptr(555), + Replicas: new(uint64(555)), UpdateConfig: &types.UpdateConfig{ - Parallelism: uint64Ptr(555), + Parallelism: new(uint64(555)), MaxFailureRatio: 3.14, }, RollbackConfig: &types.UpdateConfig{ - Parallelism: uint64Ptr(555), + Parallelism: new(uint64(555)), MaxFailureRatio: 3.14, }, RestartPolicy: &types.RestartPolicy{ - MaxAttempts: uint64Ptr(555), + MaxAttempts: new(uint64(555)), }, Placement: types.Placement{ MaxReplicas: 555, @@ -798,10 +793,10 @@ services: - example2.env `)) expectedEnvironmentMap := types.MappingWithEquals{ - "FOO": strPtr("foo_from_env_file"), - "BAZ": strPtr("baz_from_env_file"), - "BAR": strPtr("bar_from_env_file_2"), // Original value is overwritten by example2.env - "QUX": strPtr("quz_from_env_file_2"), + "FOO": new("foo_from_env_file"), + "BAZ": new("baz_from_env_file"), + "BAR": new("bar_from_env_file_2"), // Original value is overwritten by example2.env + "QUX": new("quz_from_env_file_2"), } assert.NilError(t, err) configDetails := buildConfigDetails(dict, nil) @@ -957,19 +952,6 @@ volumes: assert.Check(t, is.ErrorContains(err, `external_volume`)) } -func durationPtr(value time.Duration) *types.Duration { - result := types.Duration(value) - return &result -} - -func uint64Ptr(value uint64) *uint64 { - return &value -} - -func uint32Ptr(value uint32) *uint32 { - return &value -} - func TestFullExample(t *testing.T) { skip.If(t, runtime.GOOS == "windows", "FIXME: substitutes platform-specific HOME-dirs and requires platform-specific golden files; see https://github.com/docker/cli/pull/4610") diff --git a/cli/compose/loader/merge.go b/cli/compose/loader/merge.go index 9d8da3c6d81b..4b397a2bd62e 100644 --- a/cli/compose/loader/merge.go +++ b/cli/compose/loader/merge.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package loader diff --git a/cli/compose/loader/merge_test.go b/cli/compose/loader/merge_test.go index 11c1e888ead2..cd09a2beb5f3 100644 --- a/cli/compose/loader/merge_test.go +++ b/cli/compose/loader/merge_test.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package loader @@ -920,8 +920,8 @@ func TestLoadMultipleConfigs(t *testing.T) { Context: ".", Dockerfile: "foo.Dockerfile", Args: types.MappingWithEquals{ - "buildno": strPtr("1"), - "password": strPtr("secret"), + "buildno": new("1"), + "password": new("secret"), }, }, Ports: []types.ServicePortConfig{ @@ -1246,13 +1246,13 @@ func TestMergeServiceOverrideReplicasZero(t *testing.T) { base := types.ServiceConfig{ Name: "someService", Deploy: types.DeployConfig{ - Replicas: uint64Ptr(3), + Replicas: new(uint64(3)), }, } override := types.ServiceConfig{ Name: "someService", Deploy: types.DeployConfig{ - Replicas: uint64Ptr(0), + Replicas: new(uint64(0)), }, } services, err := mergeServices([]types.ServiceConfig{base}, []types.ServiceConfig{override}) @@ -1265,7 +1265,7 @@ func TestMergeServiceOverrideReplicasZero(t *testing.T) { types.ServiceConfig{ Name: "someService", Deploy: types.DeployConfig{ - Replicas: uint64Ptr(0), + Replicas: new(uint64(0)), }, }, ) @@ -1275,7 +1275,7 @@ func TestMergeServiceOverrideReplicasNotNil(t *testing.T) { base := types.ServiceConfig{ Name: "someService", Deploy: types.DeployConfig{ - Replicas: uint64Ptr(3), + Replicas: new(uint64(3)), }, } override := types.ServiceConfig{ @@ -1292,7 +1292,7 @@ func TestMergeServiceOverrideReplicasNotNil(t *testing.T) { types.ServiceConfig{ Name: "someService", Deploy: types.DeployConfig{ - Replicas: uint64Ptr(3), + Replicas: new(uint64(3)), }, }, ) diff --git a/cli/compose/schema/schema.go b/cli/compose/schema/schema.go index 1b21bac8e59d..f42130a0de4c 100644 --- a/cli/compose/schema/schema.go +++ b/cli/compose/schema/schema.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package schema @@ -101,8 +101,7 @@ func Validate(config map[string]any, version string) error { } if err := schema.Validate(toJSONValue(config)); err != nil { - var validationErr *jsonschema.ValidationError - if errors.As(err, &validationErr) { + if validationErr, ok := errors.AsType[*jsonschema.ValidationError](err); ok { return getMostSpecificError(validationErr) } return err diff --git a/cli/compose/schema/schema_test.go b/cli/compose/schema/schema_test.go index 36fff864af33..cef3d55223b9 100644 --- a/cli/compose/schema/schema_test.go +++ b/cli/compose/schema/schema_test.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package schema diff --git a/cli/compose/template/template.go b/cli/compose/template/template.go index 1bceadd9e313..14ba09de3599 100644 --- a/cli/compose/template/template.go +++ b/cli/compose/template/template.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package template diff --git a/cli/compose/template/template_test.go b/cli/compose/template/template_test.go index 2286ef7a2fe0..0b2d463ebbe8 100644 --- a/cli/compose/template/template_test.go +++ b/cli/compose/template/template_test.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package template diff --git a/cli/compose/types/types.go b/cli/compose/types/types.go index 6a7b41fbb5d5..ad59ce052b00 100644 --- a/cli/compose/types/types.go +++ b/cli/compose/types/types.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package types @@ -79,8 +79,7 @@ func ConvertDurationPtr(d *Duration) *time.Duration { if d == nil { return nil } - res := time.Duration(*d) - return &res + return new(time.Duration(*d)) } // MarshalJSON makes Duration implement json.Marshaler @@ -159,7 +158,7 @@ func (s Services) MarshalJSON() ([]byte, error) { type ServiceConfig struct { Name string `yaml:"-" json:"-"` - Build BuildConfig `yaml:",omitempty" json:"build,omitempty"` + Build BuildConfig `yaml:",omitempty" json:"build"` CapAdd []string `mapstructure:"cap_add" yaml:"cap_add,omitempty" json:"cap_add,omitempty"` CapDrop []string `mapstructure:"cap_drop" yaml:"cap_drop,omitempty" json:"cap_drop,omitempty"` CgroupNSMode string `mapstructure:"cgroupns_mode" yaml:"cgroupns_mode,omitempty" json:"cgroupns_mode,omitempty"` @@ -167,9 +166,9 @@ type ServiceConfig struct { Command ShellCommand `yaml:",omitempty" json:"command,omitempty"` Configs []ServiceConfigObjConfig `yaml:",omitempty" json:"configs,omitempty"` ContainerName string `mapstructure:"container_name" yaml:"container_name,omitempty" json:"container_name,omitempty"` - CredentialSpec CredentialSpecConfig `mapstructure:"credential_spec" yaml:"credential_spec,omitempty" json:"credential_spec,omitempty"` + CredentialSpec CredentialSpecConfig `mapstructure:"credential_spec" yaml:"credential_spec,omitempty" json:"credential_spec"` DependsOn []string `mapstructure:"depends_on" yaml:"depends_on,omitempty" json:"depends_on,omitempty"` - Deploy DeployConfig `yaml:",omitempty" json:"deploy,omitempty"` + Deploy DeployConfig `yaml:",omitempty" json:"deploy"` Devices []string `yaml:",omitempty" json:"devices,omitempty"` DNS StringList `yaml:",omitempty" json:"dns,omitempty"` DNSSearch StringList `mapstructure:"dns_search" yaml:"dns_search,omitempty" json:"dns_search,omitempty"` @@ -274,9 +273,9 @@ type DeployConfig struct { Labels Labels `yaml:",omitempty" json:"labels,omitempty"` UpdateConfig *UpdateConfig `mapstructure:"update_config" yaml:"update_config,omitempty" json:"update_config,omitempty"` RollbackConfig *UpdateConfig `mapstructure:"rollback_config" yaml:"rollback_config,omitempty" json:"rollback_config,omitempty"` - Resources Resources `yaml:",omitempty" json:"resources,omitempty"` + Resources Resources `yaml:",omitempty" json:"resources"` RestartPolicy *RestartPolicy `mapstructure:"restart_policy" yaml:"restart_policy,omitempty" json:"restart_policy,omitempty"` - Placement Placement `yaml:",omitempty" json:"placement,omitempty"` + Placement Placement `yaml:",omitempty" json:"placement"` EndpointMode string `mapstructure:"endpoint_mode" yaml:"endpoint_mode,omitempty" json:"endpoint_mode,omitempty"` } @@ -454,8 +453,8 @@ type NetworkConfig struct { Name string `yaml:",omitempty" json:"name,omitempty"` Driver string `yaml:",omitempty" json:"driver,omitempty"` DriverOpts map[string]string `mapstructure:"driver_opts" yaml:"driver_opts,omitempty" json:"driver_opts,omitempty"` - Ipam IPAMConfig `yaml:",omitempty" json:"ipam,omitempty"` - External External `yaml:",omitempty" json:"external,omitempty"` + Ipam IPAMConfig `yaml:",omitempty" json:"ipam"` + External External `yaml:",omitempty" json:"external"` Internal bool `yaml:",omitempty" json:"internal,omitempty"` Attachable bool `yaml:",omitempty" json:"attachable,omitempty"` Labels Labels `yaml:",omitempty" json:"labels,omitempty"` @@ -478,7 +477,7 @@ type VolumeConfig struct { Name string `yaml:",omitempty" json:"name,omitempty"` Driver string `yaml:",omitempty" json:"driver,omitempty"` DriverOpts map[string]string `mapstructure:"driver_opts" yaml:"driver_opts,omitempty" json:"driver_opts,omitempty"` - External External `yaml:",omitempty" json:"external,omitempty"` + External External `yaml:",omitempty" json:"external"` Labels Labels `yaml:",omitempty" json:"labels,omitempty"` Extras map[string]any `yaml:",inline" json:"-"` Spec *ClusterVolumeSpec `mapstructure:"x-cluster-spec" yaml:"x-cluster-spec,omitempty" json:"x-cluster-spec,omitempty"` @@ -575,7 +574,7 @@ type CredentialSpecConfig struct { type FileObjectConfig struct { Name string `yaml:",omitempty" json:"name,omitempty"` File string `yaml:",omitempty" json:"file,omitempty"` - External External `yaml:",omitempty" json:"external,omitempty"` + External External `yaml:",omitempty" json:"external"` Labels Labels `yaml:",omitempty" json:"labels,omitempty"` Extras map[string]any `yaml:",inline" json:"-"` Driver string `yaml:",omitempty" json:"driver,omitempty"` diff --git a/cli/config/configfile/file.go b/cli/config/configfile/file.go index 26e148f05987..e32b1e767cbb 100644 --- a/cli/config/configfile/file.go +++ b/cli/config/configfile/file.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package configfile @@ -232,8 +232,7 @@ func (c *ConfigFile) Save() (retErr error) { cfgFile = f } else if os.IsNotExist(err) { // extract the path from the error if the configfile does not exist or is a dangling symlink - var pathError *os.PathError - if errors.As(err, &pathError) { + if pathError, ok := errors.AsType[*os.PathError](err); ok { cfgFile = pathError.Path } } diff --git a/cli/config/memorystore/store.go b/cli/config/memorystore/store.go index 44523d392ba8..da1e94f41696 100644 --- a/cli/config/memorystore/store.go +++ b/cli/config/memorystore/store.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package memorystore diff --git a/cli/connhelper/connhelper.go b/cli/connhelper/connhelper.go index 8d97a2a40b7f..40281a56f8c2 100644 --- a/cli/connhelper/connhelper.go +++ b/cli/connhelper/connhelper.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 // Package connhelper provides helpers for connecting to a remote daemon host with custom logic. package connhelper diff --git a/cli/connhelper/ssh/ssh.go b/cli/connhelper/ssh/ssh.go index 2fcb54a98f68..b91f2bc02e11 100644 --- a/cli/connhelper/ssh/ssh.go +++ b/cli/connhelper/ssh/ssh.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.26 + // Package ssh provides the connection helper for ssh:// URL. package ssh @@ -15,8 +18,7 @@ import ( func ParseURL(daemonURL string) (*Spec, error) { u, err := url.Parse(daemonURL) if err != nil { - var urlErr *url.Error - if errors.As(err, &urlErr) { + if urlErr, ok := errors.AsType[*url.Error](err); ok { err = urlErr.Unwrap() } return nil, fmt.Errorf("invalid SSH URL: %w", err) diff --git a/cli/context/store/metadata_test.go b/cli/context/store/metadata_test.go index aff59820926f..8c6389894b2d 100644 --- a/cli/context/store/metadata_test.go +++ b/cli/context/store/metadata_test.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package store diff --git a/cli/context/store/metadatastore.go b/cli/context/store/metadatastore.go index 8703e1c6c0d7..8bada79fe51d 100644 --- a/cli/context/store/metadatastore.go +++ b/cli/context/store/metadatastore.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package store diff --git a/cli/context/store/store.go b/cli/context/store/store.go index 2b8b5c311478..4122e077927f 100644 --- a/cli/context/store/store.go +++ b/cli/context/store/store.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package store diff --git a/cli/context/store/store_test.go b/cli/context/store/store_test.go index 20d0ef6463f6..25bfd87c75c0 100644 --- a/cli/context/store/store_test.go +++ b/cli/context/store/store_test.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package store diff --git a/cli/context/store/storeconfig.go b/cli/context/store/storeconfig.go index 4b42e7377931..79fb2da3f9bf 100644 --- a/cli/context/store/storeconfig.go +++ b/cli/context/store/storeconfig.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package store diff --git a/cli/context/store/storeconfig_test.go b/cli/context/store/storeconfig_test.go index 840d4ee53b21..51b5758e94ab 100644 --- a/cli/context/store/storeconfig_test.go +++ b/cli/context/store/storeconfig_test.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package store diff --git a/cli/streams/stream.go b/cli/streams/stream.go index f6356ccf347d..8a357718d586 100644 --- a/cli/streams/stream.go +++ b/cli/streams/stream.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package streams diff --git a/cmd/docker-trust/internal/registry/config.go b/cmd/docker-trust/internal/registry/config.go index e753fd11aff5..41f8e4b5f306 100644 --- a/cmd/docker-trust/internal/registry/config.go +++ b/cmd/docker-trust/internal/registry/config.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package registry diff --git a/cmd/docker-trust/internal/registry/errors.go b/cmd/docker-trust/internal/registry/errors.go index a9e75dbdd9ec..d0bdbe2e8315 100644 --- a/cmd/docker-trust/internal/registry/errors.go +++ b/cmd/docker-trust/internal/registry/errors.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package registry diff --git a/cmd/docker-trust/trust/inspect.go b/cmd/docker-trust/trust/inspect.go index c7688e50b239..fabb1d7a131e 100644 --- a/cmd/docker-trust/trust/inspect.go +++ b/cmd/docker-trust/trust/inspect.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package trust diff --git a/cmd/docker/builder_test.go b/cmd/docker/builder_test.go index a23b52b92219..9f7d67bf4742 100644 --- a/cmd/docker/builder_test.go +++ b/cmd/docker/builder_test.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package main diff --git a/cmd/docker/docker.go b/cmd/docker/docker.go index 0efcc70118fe..7987ffa3f7b4 100644 --- a/cmd/docker/docker.go +++ b/cmd/docker/docker.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package main @@ -101,8 +101,7 @@ func getExitCode(err error) int { return 0 } - var userTerminatedErr errCtxSignalTerminated - if errors.As(err, &userTerminatedErr) { + if userTerminatedErr, ok := errors.AsType[errCtxSignalTerminated](err); ok { s, ok := userTerminatedErr.signal.(syscall.Signal) if !ok { return 1 diff --git a/internal/oauth/api/api.go b/internal/oauth/api/api.go index f0d744da3cc1..9526f84c9910 100644 --- a/internal/oauth/api/api.go +++ b/internal/oauth/api/api.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package api diff --git a/internal/registry/config.go b/internal/registry/config.go index 11d6c9562502..24b5eedfe3d6 100644 --- a/internal/registry/config.go +++ b/internal/registry/config.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package registry diff --git a/internal/registry/errors.go b/internal/registry/errors.go index 589831bf0565..7b12a8461f30 100644 --- a/internal/registry/errors.go +++ b/internal/registry/errors.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package registry @@ -12,8 +12,7 @@ import ( ) func translateV2AuthError(err error) error { - var e *url.Error - if errors.As(err, &e) { + if e, ok := errors.AsType[*url.Error](err); ok { var e2 errcode.Error if errors.As(e, &e2) && errors.Is(e2.Code, errcode.ErrorCodeUnauthorized) { return unauthorizedErr{err} diff --git a/internal/registryclient/fetcher.go b/internal/registryclient/fetcher.go index cad5451f8f7f..5bc308b4cb0f 100644 --- a/internal/registryclient/fetcher.go +++ b/internal/registryclient/fetcher.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.26 + package registryclient import ( @@ -244,8 +247,7 @@ func (c *client) iterateEndpoints(ctx context.Context, namedRef reference.Named, repo, err := c.getRepositoryForReference(ctx, namedRef, repoEndpoint) if err != nil { logrus.Debugf("error %s with repo endpoint %+v", err, repoEndpoint) - var protoErr httpProtoError - if errors.As(err, &protoErr) { + if _, ok := errors.AsType[httpProtoError](err); ok { continue } return err diff --git a/internal/test/strings.go b/internal/test/strings.go index 0532de8a037b..cdf118dc09df 100644 --- a/internal/test/strings.go +++ b/internal/test/strings.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package test diff --git a/internal/tui/chip.go b/internal/tui/chip.go index 477d43103b80..893046264f04 100644 --- a/internal/tui/chip.go +++ b/internal/tui/chip.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package tui diff --git a/internal/tui/colors.go b/internal/tui/colors.go index 854e55ecd0c3..2b6a0f1f30c4 100644 --- a/internal/tui/colors.go +++ b/internal/tui/colors.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package tui diff --git a/internal/tui/count.go b/internal/tui/count.go index 303d650e5113..05d034808df6 100644 --- a/internal/tui/count.go +++ b/internal/tui/count.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package tui diff --git a/internal/tui/note.go b/internal/tui/note.go index 83f1f621e912..1e2f538d9733 100644 --- a/internal/tui/note.go +++ b/internal/tui/note.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package tui diff --git a/internal/tui/output.go b/internal/tui/output.go index 1776640af517..9022e66ae8cb 100644 --- a/internal/tui/output.go +++ b/internal/tui/output.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package tui diff --git a/internal/tui/str.go b/internal/tui/str.go index 9d50f7bd369f..819af243cd58 100644 --- a/internal/tui/str.go +++ b/internal/tui/str.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package tui diff --git a/internal/volumespec/volumespec.go b/internal/volumespec/volumespec.go index fcc5aa823b7f..8f497714c83e 100644 --- a/internal/volumespec/volumespec.go +++ b/internal/volumespec/volumespec.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package volumespec diff --git a/opts/gpus.go b/opts/gpus.go index e68ede7a085f..3905a691aca5 100644 --- a/opts/gpus.go +++ b/opts/gpus.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.26 + package opts import ( @@ -21,8 +24,7 @@ func parseCount(s string) (int, error) { } i, err := strconv.Atoi(s) if err != nil { - var numErr *strconv.NumError - if errors.As(err, &numErr) { + if numErr, ok := errors.AsType[*strconv.NumError](err); ok { err = numErr.Err } return 0, fmt.Errorf(`invalid count (%s): value must be either "all" or an integer: %w`, s, err) diff --git a/opts/network.go b/opts/network.go index 489ef8be3971..51f50f2070b1 100644 --- a/opts/network.go +++ b/opts/network.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.26 + package opts import ( @@ -100,8 +103,7 @@ func (n *NetworkOpt) Set(value string) error { //nolint:gocyclo case gwPriorityOpt: netOpt.GwPriority, err = strconv.Atoi(val) if err != nil { - var numErr *strconv.NumError - if errors.As(err, &numErr) { + if numErr, ok := errors.AsType[*strconv.NumError](err); ok { err = numErr.Err } return fmt.Errorf("invalid gw-priority (%s): %w", val, err) diff --git a/opts/opts.go b/opts/opts.go index 2e0adac6e0db..b944a479d858 100644 --- a/opts/opts.go +++ b/opts/opts.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package opts diff --git a/opts/swarmopts/port.go b/opts/swarmopts/port.go index 2ed10bb2dd94..589c12795900 100644 --- a/opts/swarmopts/port.go +++ b/opts/swarmopts/port.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package swarmopts @@ -73,8 +73,7 @@ func (p *PortOpt) Set(value string) error { case portOptTargetPort: tPort, err := strconv.ParseUint(val, 10, 16) if err != nil { - var numErr *strconv.NumError - if errors.As(err, &numErr) { + if numErr, ok := errors.AsType[*strconv.NumError](err); ok { err = numErr.Err } return fmt.Errorf("invalid target port (%s): value must be an integer: %w", val, err) @@ -84,8 +83,7 @@ func (p *PortOpt) Set(value string) error { case portOptPublishedPort: pPort, err := strconv.ParseUint(val, 10, 16) if err != nil { - var numErr *strconv.NumError - if errors.As(err, &numErr) { + if numErr, ok := errors.AsType[*strconv.NumError](err); ok { err = numErr.Err } return fmt.Errorf("invalid published port (%s): value must be an integer: %w", val, err) diff --git a/opts/swarmopts/port_test.go b/opts/swarmopts/port_test.go index 5ccf28052cb0..dd224f1e4cb7 100644 --- a/opts/swarmopts/port_test.go +++ b/opts/swarmopts/port_test.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package swarmopts diff --git a/templates/templates.go b/templates/templates.go index e156ca57514f..24f29c179fc6 100644 --- a/templates/templates.go +++ b/templates/templates.go @@ -1,5 +1,5 @@ // FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: -//go:build go1.25 +//go:build go1.26 package templates diff --git a/vendor.mod b/vendor.mod index 0a21b030550f..6d66e1f9c576 100644 --- a/vendor.mod +++ b/vendor.mod @@ -4,7 +4,7 @@ module github.com/docker/cli // There is no 'go.mod' file, as that would imply opting in for all the rules // around SemVer, which this repo cannot abide by as it uses CalVer. -go 1.25.0 +go 1.26 tool ( github.com/cpuguy83/go-md2man/v2 // for scripts/docs/generate-man.sh