Replace golang.org/x/exp/slices with slices from std

Use "slices" from the standard library, this package was added in go
1.21 so we can use it now.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger 2024-04-23 11:16:40 +02:00
parent c04d03ef8c
commit 83dbbc3a51
No known key found for this signature in database
GPG Key ID: EB145DD938A3CAF2
33 changed files with 34 additions and 35 deletions

View File

@ -5,6 +5,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"os" "os"
"slices"
"strconv" "strconv"
"strings" "strings"
@ -23,7 +24,6 @@ import (
"github.com/containers/podman/v5/pkg/util" "github.com/containers/podman/v5/pkg/util"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"golang.org/x/exp/slices"
"golang.org/x/term" "golang.org/x/term"
) )

View File

@ -4,6 +4,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"os" "os"
"slices"
"strconv" "strconv"
"strings" "strings"
"time" "time"
@ -20,7 +21,6 @@ import (
"github.com/docker/go-units" "github.com/docker/go-units"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"golang.org/x/exp/slices"
) )
var ( var (

View File

@ -2,13 +2,13 @@ package farm
import ( import (
"fmt" "fmt"
"slices"
"github.com/containers/common/pkg/completion" "github.com/containers/common/pkg/completion"
"github.com/containers/common/pkg/config" "github.com/containers/common/pkg/config"
"github.com/containers/podman/v5/cmd/podman/registry" "github.com/containers/podman/v5/cmd/podman/registry"
"github.com/containers/podman/v5/cmd/podman/validate" "github.com/containers/podman/v5/cmd/podman/validate"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"golang.org/x/exp/slices"
) )
var ( var (

View File

@ -3,6 +3,7 @@ package farm
import ( import (
"errors" "errors"
"fmt" "fmt"
"slices"
"github.com/containers/common/pkg/completion" "github.com/containers/common/pkg/completion"
"github.com/containers/common/pkg/config" "github.com/containers/common/pkg/config"
@ -10,7 +11,6 @@ import (
"github.com/containers/podman/v5/cmd/podman/registry" "github.com/containers/podman/v5/cmd/podman/registry"
"github.com/containers/podman/v5/cmd/podman/validate" "github.com/containers/podman/v5/cmd/podman/validate"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"golang.org/x/exp/slices"
) )
var ( var (

View File

@ -5,6 +5,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"os" "os"
"slices"
"strings" "strings"
"github.com/containers/common/pkg/completion" "github.com/containers/common/pkg/completion"
@ -14,7 +15,6 @@ import (
"github.com/containers/podman/v5/libpod/define" "github.com/containers/podman/v5/libpod/define"
"github.com/containers/podman/v5/pkg/domain/entities" "github.com/containers/podman/v5/pkg/domain/entities"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"golang.org/x/exp/slices"
"golang.org/x/term" "golang.org/x/term"
) )

View File

@ -4,13 +4,13 @@ import (
"fmt" "fmt"
"net/url" "net/url"
"regexp" "regexp"
"slices"
"github.com/containers/common/pkg/completion" "github.com/containers/common/pkg/completion"
"github.com/containers/podman/v5/cmd/podman/common" "github.com/containers/podman/v5/cmd/podman/common"
"github.com/containers/podman/v5/cmd/podman/registry" "github.com/containers/podman/v5/cmd/podman/registry"
"github.com/containers/podman/v5/pkg/domain/entities" "github.com/containers/podman/v5/pkg/domain/entities"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"golang.org/x/exp/slices"
) )
var ( var (

View File

@ -3,6 +3,7 @@ package connection
import ( import (
"fmt" "fmt"
"os" "os"
"slices"
"sort" "sort"
"github.com/containers/common/pkg/completion" "github.com/containers/common/pkg/completion"
@ -13,7 +14,6 @@ import (
"github.com/containers/podman/v5/cmd/podman/system" "github.com/containers/podman/v5/cmd/podman/system"
"github.com/containers/podman/v5/cmd/podman/validate" "github.com/containers/podman/v5/cmd/podman/validate"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"golang.org/x/exp/slices"
) )
var ( var (

View File

@ -2,13 +2,13 @@ package connection
import ( import (
"errors" "errors"
"slices"
"github.com/containers/common/pkg/config" "github.com/containers/common/pkg/config"
"github.com/containers/podman/v5/cmd/podman/common" "github.com/containers/podman/v5/cmd/podman/common"
"github.com/containers/podman/v5/cmd/podman/registry" "github.com/containers/podman/v5/cmd/podman/registry"
"github.com/containers/podman/v5/cmd/podman/system" "github.com/containers/podman/v5/cmd/podman/system"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"golang.org/x/exp/slices"
) )
var ( var (

View File

@ -11,6 +11,7 @@ import (
"io/fs" "io/fs"
"os" "os"
"path/filepath" "path/filepath"
"slices"
"strconv" "strconv"
"strings" "strings"
"time" "time"
@ -49,7 +50,6 @@ import (
"github.com/opencontainers/runtime-tools/generate" "github.com/opencontainers/runtime-tools/generate"
"github.com/opencontainers/selinux/go-selinux/label" "github.com/opencontainers/selinux/go-selinux/label"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"golang.org/x/exp/slices"
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
) )

View File

@ -15,6 +15,7 @@ import (
"path" "path"
"path/filepath" "path/filepath"
"runtime" "runtime"
"slices"
"strconv" "strconv"
"strings" "strings"
"syscall" "syscall"
@ -57,7 +58,6 @@ import (
"github.com/opencontainers/selinux/go-selinux" "github.com/opencontainers/selinux/go-selinux"
"github.com/opencontainers/selinux/go-selinux/label" "github.com/opencontainers/selinux/go-selinux/label"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"golang.org/x/exp/slices"
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
cdi "tags.cncf.io/container-device-interface/pkg/cdi" cdi "tags.cncf.io/container-device-interface/pkg/cdi"
) )

View File

@ -11,6 +11,7 @@ import (
"os/exec" "os/exec"
"path/filepath" "path/filepath"
"runtime" "runtime"
"slices"
"strconv" "strconv"
"strings" "strings"
"syscall" "syscall"
@ -22,7 +23,6 @@ import (
"github.com/containers/storage/pkg/reexec" "github.com/containers/storage/pkg/reexec"
"github.com/google/shlex" "github.com/google/shlex"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"golang.org/x/exp/slices"
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
) )

View File

@ -9,6 +9,7 @@ import (
"math/rand" "math/rand"
"os" "os"
"reflect" "reflect"
"slices"
"sort" "sort"
"strconv" "strconv"
"strings" "strings"
@ -29,7 +30,6 @@ import (
"github.com/containers/podman/v5/pkg/util" "github.com/containers/podman/v5/pkg/util"
"github.com/opencontainers/runtime-spec/specs-go" "github.com/opencontainers/runtime-spec/specs-go"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"golang.org/x/exp/slices"
) )
// GenerateForKube takes a slice of libpod containers and generates // GenerateForKube takes a slice of libpod containers and generates

View File

@ -6,6 +6,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"regexp" "regexp"
"slices"
"sort" "sort"
"github.com/containers/common/libnetwork/etchosts" "github.com/containers/common/libnetwork/etchosts"
@ -18,7 +19,6 @@ import (
"github.com/containers/podman/v5/pkg/rootless" "github.com/containers/podman/v5/pkg/rootless"
"github.com/containers/storage/pkg/lockfile" "github.com/containers/storage/pkg/lockfile"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"golang.org/x/exp/slices"
) )
// convertPortMappings will remove the HostIP part from the ports when running inside podman machine. // convertPortMappings will remove the HostIP part from the ports when running inside podman machine.

View File

@ -10,6 +10,7 @@ import (
"os" "os"
"path" "path"
"path/filepath" "path/filepath"
"slices"
"strings" "strings"
"time" "time"
@ -30,7 +31,6 @@ import (
spec "github.com/opencontainers/runtime-spec/specs-go" spec "github.com/opencontainers/runtime-spec/specs-go"
"github.com/opencontainers/runtime-tools/generate" "github.com/opencontainers/runtime-tools/generate"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"golang.org/x/exp/slices"
) )
// Contains the public Runtime API for containers // Contains the public Runtime API for containers

View File

@ -6,10 +6,10 @@ import (
"context" "context"
"errors" "errors"
"fmt" "fmt"
"slices"
"time" "time"
"github.com/containers/podman/v5/libpod/define" "github.com/containers/podman/v5/libpod/define"
"golang.org/x/exp/slices"
) )
// Contains the public Runtime API for pods // Contains the public Runtime API for pods

View File

@ -11,6 +11,7 @@ import (
"net/textproto" "net/textproto"
"os" "os"
"path/filepath" "path/filepath"
"slices"
"strconv" "strconv"
"strings" "strings"
"sync" "sync"
@ -25,7 +26,6 @@ import (
"github.com/containers/podman/v5/pkg/errorhandling" "github.com/containers/podman/v5/pkg/errorhandling"
dockerAPI "github.com/docker/docker/api/types" dockerAPI "github.com/docker/docker/api/types"
jsoniter "github.com/json-iterator/go" jsoniter "github.com/json-iterator/go"
"golang.org/x/exp/slices"
) )
// Create creates a manifest for the given name. Optional images to be associated with // Create creates a manifest for the given name. Optional images to be associated with

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"fmt" "fmt"
"net/http" "net/http"
"slices"
"time" "time"
"github.com/containers/common/libnetwork/types" "github.com/containers/common/libnetwork/types"
@ -13,7 +14,6 @@ import (
. "github.com/onsi/ginkgo/v2" . "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec" "github.com/onsi/gomega/gexec"
"golang.org/x/exp/slices"
) )
var _ = Describe("Podman networks", func() { var _ = Describe("Podman networks", func() {

View File

@ -3,6 +3,7 @@ package bindings_test
import ( import (
"fmt" "fmt"
"net/http" "net/http"
"slices"
"strings" "strings"
"time" "time"
@ -16,7 +17,6 @@ import (
. "github.com/onsi/ginkgo/v2" . "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec" "github.com/onsi/gomega/gexec"
"golang.org/x/exp/slices"
) )
var _ = Describe("Podman pods", func() { var _ = Describe("Podman pods", func() {

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"fmt" "fmt"
"net/http" "net/http"
"slices"
"time" "time"
"github.com/containers/podman/v5/pkg/bindings" "github.com/containers/podman/v5/pkg/bindings"
@ -14,7 +15,6 @@ import (
. "github.com/onsi/ginkgo/v2" . "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec" "github.com/onsi/gomega/gexec"
"golang.org/x/exp/slices"
) )
var _ = Describe("Podman volumes", func() { var _ = Describe("Podman volumes", func() {

View File

@ -5,6 +5,7 @@ package filters
import ( import (
"errors" "errors"
"fmt" "fmt"
"slices"
"strconv" "strconv"
"strings" "strings"
"time" "time"
@ -13,7 +14,6 @@ import (
"github.com/containers/common/pkg/util" "github.com/containers/common/pkg/util"
"github.com/containers/podman/v5/libpod" "github.com/containers/podman/v5/libpod"
"github.com/containers/podman/v5/libpod/define" "github.com/containers/podman/v5/libpod/define"
"golang.org/x/exp/slices"
) )
// GenerateContainerFilterFuncs return ContainerFilter functions based of filter. // GenerateContainerFilterFuncs return ContainerFilter functions based of filter.

View File

@ -5,6 +5,7 @@ package filters
import ( import (
"errors" "errors"
"fmt" "fmt"
"slices"
"strconv" "strconv"
"strings" "strings"
@ -12,7 +13,6 @@ import (
"github.com/containers/common/pkg/util" "github.com/containers/common/pkg/util"
"github.com/containers/podman/v5/libpod" "github.com/containers/podman/v5/libpod"
"github.com/containers/podman/v5/libpod/define" "github.com/containers/podman/v5/libpod/define"
"golang.org/x/exp/slices"
) )
// GeneratePodFilterFunc takes a filter and filtervalue (key, value) // GeneratePodFilterFunc takes a filter and filtervalue (key, value)

View File

@ -3,11 +3,11 @@ package abi
import ( import (
"context" "context"
"fmt" "fmt"
"slices"
"github.com/containers/common/libimage" "github.com/containers/common/libimage"
"github.com/containers/podman/v5/libpod/define" "github.com/containers/podman/v5/libpod/define"
"github.com/containers/podman/v5/pkg/domain/entities" "github.com/containers/podman/v5/pkg/domain/entities"
"golang.org/x/exp/slices"
) )
func (ir *ImageEngine) List(ctx context.Context, opts entities.ImageListOptions) ([]*entities.ImageSummary, error) { func (ir *ImageEngine) List(ctx context.Context, opts entities.ImageListOptions) ([]*entities.ImageSummary, error) {

View File

@ -4,13 +4,13 @@ import (
"bytes" "bytes"
"context" "context"
"encoding/json" "encoding/json"
"errors"
"fmt" "fmt"
"os" "os"
"path" "path"
"slices"
"strings" "strings"
"errors"
"github.com/containers/common/libimage" "github.com/containers/common/libimage"
cp "github.com/containers/image/v5/copy" cp "github.com/containers/image/v5/copy"
"github.com/containers/image/v5/docker" "github.com/containers/image/v5/docker"
@ -26,7 +26,6 @@ import (
"github.com/opencontainers/go-digest" "github.com/opencontainers/go-digest"
imgspecv1 "github.com/opencontainers/image-spec/specs-go/v1" imgspecv1 "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"golang.org/x/exp/slices"
) )
// ManifestCreate implements logic for creating manifest lists via ImageEngine // ManifestCreate implements logic for creating manifest lists via ImageEngine

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"errors" "errors"
"fmt" "fmt"
"slices"
"strconv" "strconv"
"github.com/containers/common/libnetwork/pasta" "github.com/containers/common/libnetwork/pasta"
@ -12,7 +13,6 @@ import (
netutil "github.com/containers/common/libnetwork/util" netutil "github.com/containers/common/libnetwork/util"
"github.com/containers/podman/v5/libpod/define" "github.com/containers/podman/v5/libpod/define"
"github.com/containers/podman/v5/pkg/domain/entities" "github.com/containers/podman/v5/pkg/domain/entities"
"golang.org/x/exp/slices"
) )
func (ic *ContainerEngine) NetworkUpdate(ctx context.Context, netName string, options entities.NetworkUpdateOptions) error { func (ic *ContainerEngine) NetworkUpdate(ctx context.Context, netName string, options entities.NetworkUpdateOptions) error {

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"encoding/json" "encoding/json"
"fmt" "fmt"
"slices"
"strings" "strings"
"github.com/containers/image/v5/types" "github.com/containers/image/v5/types"
@ -11,7 +12,6 @@ import (
"github.com/containers/podman/v5/pkg/bindings/manifests" "github.com/containers/podman/v5/pkg/bindings/manifests"
"github.com/containers/podman/v5/pkg/domain/entities" "github.com/containers/podman/v5/pkg/domain/entities"
envLib "github.com/containers/podman/v5/pkg/env" envLib "github.com/containers/podman/v5/pkg/env"
"golang.org/x/exp/slices"
) )
// ManifestCreate implements manifest create via ImageEngine // ManifestCreate implements manifest create via ImageEngine

View File

@ -6,6 +6,7 @@ import (
"os" "os"
"os/exec" "os/exec"
"path/filepath" "path/filepath"
"slices"
"strconv" "strconv"
"strings" "strings"
"time" "time"
@ -18,7 +19,6 @@ import (
"github.com/onsi/gomega/format" "github.com/onsi/gomega/format"
. "github.com/onsi/gomega/gexec" . "github.com/onsi/gomega/gexec"
"github.com/onsi/gomega/types" "github.com/onsi/gomega/types"
"golang.org/x/exp/slices"
) )
var originalHomeDir = os.Getenv("HOME") var originalHomeDir = os.Getenv("HOME")

View File

@ -1,6 +1,7 @@
package e2e_test package e2e_test
import ( import (
"slices"
"strconv" "strconv"
"strings" "strings"
"time" "time"
@ -10,7 +11,6 @@ import (
. "github.com/onsi/ginkgo/v2" . "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
. "github.com/onsi/gomega/gexec" . "github.com/onsi/gomega/gexec"
"golang.org/x/exp/slices"
) )
var _ = Describe("podman machine list", func() { var _ = Describe("podman machine list", func() {

View File

@ -3,10 +3,10 @@ package specgen
import ( import (
"errors" "errors"
"fmt" "fmt"
"slices"
"strings" "strings"
"github.com/containers/podman/v5/libpod/define" "github.com/containers/podman/v5/libpod/define"
"golang.org/x/exp/slices"
) )
var ( var (

View File

@ -12,6 +12,7 @@ import (
"os" "os"
"regexp" "regexp"
"runtime" "runtime"
"slices"
"strconv" "strconv"
"strings" "strings"
"time" "time"
@ -37,7 +38,6 @@ import (
"github.com/docker/go-units" "github.com/docker/go-units"
spec "github.com/opencontainers/runtime-spec/specs-go" spec "github.com/opencontainers/runtime-spec/specs-go"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"golang.org/x/exp/slices"
"sigs.k8s.io/yaml" "sigs.k8s.io/yaml"
) )

View File

@ -5,6 +5,7 @@ package generate
import ( import (
"fmt" "fmt"
"net" "net"
"slices"
"sort" "sort"
"strings" "strings"
@ -14,7 +15,6 @@ import (
"github.com/containers/podman/v5/pkg/specgenutil" "github.com/containers/podman/v5/pkg/specgenutil"
"github.com/containers/podman/v5/utils" "github.com/containers/podman/v5/utils"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"golang.org/x/exp/slices"
) )
const ( const (

View File

@ -4,6 +4,7 @@ package generate
import ( import (
"fmt" "fmt"
"slices"
"strings" "strings"
"github.com/containers/common/libimage" "github.com/containers/common/libimage"
@ -17,7 +18,6 @@ import (
"github.com/opencontainers/runtime-tools/generate" "github.com/opencontainers/runtime-tools/generate"
"github.com/opencontainers/selinux/go-selinux/label" "github.com/opencontainers/selinux/go-selinux/label"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"golang.org/x/exp/slices"
) )
// setLabelOpts sets the label options of the SecurityConfig according to the // setLabelOpts sets the label options of the SecurityConfig according to the

View File

@ -4,6 +4,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"net" "net"
"slices"
"strings" "strings"
"github.com/containers/common/libnetwork/types" "github.com/containers/common/libnetwork/types"
@ -16,7 +17,6 @@ import (
storageTypes "github.com/containers/storage/types" storageTypes "github.com/containers/storage/types"
spec "github.com/opencontainers/runtime-spec/specs-go" spec "github.com/opencontainers/runtime-spec/specs-go"
"github.com/opencontainers/runtime-tools/generate" "github.com/opencontainers/runtime-tools/generate"
"golang.org/x/exp/slices"
) )
type NamespaceMode string type NamespaceMode string

View File

@ -12,6 +12,7 @@ import (
"os" "os"
"os/exec" "os/exec"
"path/filepath" "path/filepath"
"slices"
"sort" "sort"
"strconv" "strconv"
"strings" "strings"
@ -32,7 +33,6 @@ import (
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
. "github.com/onsi/gomega/gexec" . "github.com/onsi/gomega/gexec"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"golang.org/x/exp/slices"
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
) )