build: go 1.24

We were running behind and there were quite some deprecations to update.
This was mostly in the upstream copy/pasta package but seems quite
minimal.
This commit is contained in:
2025-03-16 12:04:32 +01:00
parent a2b678caf6
commit 1723025fbf
822 changed files with 25433 additions and 197407 deletions

View File

@ -80,7 +80,7 @@ func (o *ConfigOpt) Set(value string) error {
}
// Type returns the type of this option
func (o *ConfigOpt) Type() string {
func (*ConfigOpt) Type() string {
return "config"
}

View File

@ -46,7 +46,7 @@ func (d *DurationOpt) Set(s string) error {
}
// Type returns the type of this option, which will be displayed in `--help` output
func (d *DurationOpt) Type() string {
func (*DurationOpt) Type() string {
return "duration"
}

View File

@ -92,7 +92,7 @@ func (o *GpuOpts) Set(value string) error {
}
// Type returns the type of this option
func (o *GpuOpts) Type() string {
func (*GpuOpts) Type() string {
return "gpu-request"
}

View File

@ -43,6 +43,13 @@ func (m *MountOpt) Set(value string) error {
return mount.VolumeOptions
}
imageOptions := func() *mounttypes.ImageOptions {
if mount.ImageOptions == nil {
mount.ImageOptions = new(mounttypes.ImageOptions)
}
return mount.ImageOptions
}
bindOptions := func() *mounttypes.BindOptions {
if mount.BindOptions == nil {
mount.BindOptions = new(mounttypes.BindOptions)
@ -147,6 +154,8 @@ func (m *MountOpt) Set(value string) error {
volumeOptions().DriverConfig.Options = make(map[string]string)
}
setValueOnMap(volumeOptions().DriverConfig.Options, val)
case "image-subpath":
imageOptions().Subpath = val
case "tmpfs-size":
sizeBytes, err := units.RAMInBytes(val)
if err != nil {
@ -175,6 +184,9 @@ func (m *MountOpt) Set(value string) error {
if mount.VolumeOptions != nil && mount.Type != mounttypes.TypeVolume {
return fmt.Errorf("cannot mix 'volume-*' options with mount type '%s'", mount.Type)
}
if mount.ImageOptions != nil && mount.Type != mounttypes.TypeImage {
return fmt.Errorf("cannot mix 'image-*' options with mount type '%s'", mount.Type)
}
if mount.BindOptions != nil && mount.Type != mounttypes.TypeBind {
return fmt.Errorf("cannot mix 'bind-*' options with mount type '%s'", mount.Type)
}
@ -203,7 +215,7 @@ func (m *MountOpt) Set(value string) error {
}
// Type returns the type of this option
func (m *MountOpt) Type() string {
func (*MountOpt) Type() string {
return "mount"
}

View File

@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"regexp"
"strconv"
"strings"
)
@ -16,6 +17,7 @@ const (
networkOptMacAddress = "mac-address"
networkOptLinkLocalIP = "link-local-ip"
driverOpt = "driver-opt"
gwPriorityOpt = "gw-priority"
)
// NetworkAttachmentOpts represents the network options for endpoint creation
@ -28,6 +30,7 @@ type NetworkAttachmentOpts struct {
IPv6Address string
LinkLocalIPs []string
MacAddress string
GwPriority int
}
// NetworkOpt represents a network config in swarm mode.
@ -83,6 +86,11 @@ func (n *NetworkOpt) Set(value string) error { //nolint:gocyclo
netOpt.DriverOpts = make(map[string]string)
}
netOpt.DriverOpts[key] = val
case gwPriorityOpt:
netOpt.GwPriority, err = strconv.Atoi(val)
if err != nil {
return fmt.Errorf("invalid gw-priority: %w", err)
}
default:
return errors.New("invalid field key " + key)
}
@ -98,7 +106,7 @@ func (n *NetworkOpt) Set(value string) error { //nolint:gocyclo
}
// Type returns the type of this option
func (n *NetworkOpt) Type() string {
func (*NetworkOpt) Type() string {
return "network"
}
@ -108,7 +116,7 @@ func (n *NetworkOpt) Value() []NetworkAttachmentOpts {
}
// String returns the network opts as a string
func (n *NetworkOpt) String() string {
func (*NetworkOpt) String() string {
return ""
}

View File

@ -110,7 +110,7 @@ func (opts *ListOpts) Len() int {
}
// Type returns a string name for this Option type
func (opts *ListOpts) Type() string {
func (*ListOpts) Type() string {
return "list"
}
@ -180,7 +180,7 @@ func (opts *MapOpts) String() string {
}
// Type returns a string name for this Option type
func (opts *MapOpts) Type() string {
func (*MapOpts) Type() string {
return "map"
}
@ -358,7 +358,7 @@ func (o *FilterOpt) Set(value string) error {
}
// Type returns the option type
func (o *FilterOpt) Type() string {
func (*FilterOpt) Type() string {
return "filter"
}
@ -386,7 +386,7 @@ func (c *NanoCPUs) Set(value string) error {
}
// Type returns the type
func (c *NanoCPUs) Type() string {
func (*NanoCPUs) Type() string {
return "decimal"
}
@ -463,7 +463,7 @@ func (m *MemBytes) Set(value string) error {
}
// Type returns the type
func (m *MemBytes) Type() string {
func (*MemBytes) Type() string {
return "bytes"
}
@ -498,7 +498,7 @@ func (m *MemSwapBytes) Set(value string) error {
}
// Type returns the type
func (m *MemSwapBytes) Type() string {
func (*MemSwapBytes) Type() string {
return "bytes"
}

View File

@ -121,7 +121,7 @@ func (p *PortOpt) Set(value string) error {
}
// Type returns the type of this option
func (p *PortOpt) Type() string {
func (*PortOpt) Type() string {
return "port"
}

View File

@ -13,7 +13,7 @@ func (s *QuotedString) Set(val string) error {
}
// Type returns the type of the value
func (s *QuotedString) Type() string {
func (*QuotedString) Type() string {
return "string"
}

View File

@ -79,7 +79,7 @@ func (o *SecretOpt) Set(value string) error {
}
// Type returns the type of this option
func (o *SecretOpt) Type() string {
func (*SecretOpt) Type() string {
return "secret"
}

View File

@ -100,6 +100,6 @@ func (opt *ThrottledeviceOpt) GetList() []*blkiodev.ThrottleDevice {
}
// Type returns the option type
func (opt *ThrottledeviceOpt) Type() string {
func (*ThrottledeviceOpt) Type() string {
return "list"
}

View File

@ -58,6 +58,6 @@ func (o *UlimitOpt) GetList() []*container.Ulimit {
}
// Type returns the option type
func (o *UlimitOpt) Type() string {
func (*UlimitOpt) Type() string {
return "ulimit"
}

View File

@ -79,6 +79,6 @@ func (opt *WeightdeviceOpt) GetList() []*blkiodev.WeightDevice {
}
// Type returns the option type
func (opt *WeightdeviceOpt) Type() string {
func (*WeightdeviceOpt) Type() string {
return "list"
}