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

View File

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

View File

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

View File

@ -3,6 +3,7 @@ package farm
import (
"errors"
"fmt"
"slices"
"github.com/containers/common/pkg/completion"
"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/validate"
"github.com/spf13/cobra"
"golang.org/x/exp/slices"
)
var (

View File

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

View File

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

View File

@ -3,6 +3,7 @@ package connection
import (
"fmt"
"os"
"slices"
"sort"
"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/validate"
"github.com/spf13/cobra"
"golang.org/x/exp/slices"
)
var (

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -11,6 +11,7 @@ import (
"net/textproto"
"os"
"path/filepath"
"slices"
"strconv"
"strings"
"sync"
@ -25,7 +26,6 @@ import (
"github.com/containers/podman/v5/pkg/errorhandling"
dockerAPI "github.com/docker/docker/api/types"
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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,11 +3,11 @@ package abi
import (
"context"
"fmt"
"slices"
"github.com/containers/common/libimage"
"github.com/containers/podman/v5/libpod/define"
"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) {

View File

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

View File

@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"slices"
"strconv"
"github.com/containers/common/libnetwork/pasta"
@ -12,7 +13,6 @@ import (
netutil "github.com/containers/common/libnetwork/util"
"github.com/containers/podman/v5/libpod/define"
"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 {

View File

@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
"slices"
"strings"
"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/domain/entities"
envLib "github.com/containers/podman/v5/pkg/env"
"golang.org/x/exp/slices"
)
// ManifestCreate implements manifest create via ImageEngine

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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