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-22 14:07:33 +02:00
parent 2044d0b48a
commit 7e485a635f
17 changed files with 18 additions and 17 deletions

View File

@ -1,9 +1,10 @@
package internal
import (
"slices"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
"golang.org/x/exp/maps"
"golang.org/x/exp/slices"
)
// DeepCopyDescriptor copies a Descriptor, deeply copying its contents

View File

@ -6,6 +6,7 @@ import (
"context"
"errors"
"fmt"
"slices"
"time"
"github.com/containers/common/libimage/define"
@ -20,7 +21,6 @@ import (
"github.com/opencontainers/go-digest"
imgspecv1 "github.com/opencontainers/image-spec/specs-go/v1"
"golang.org/x/exp/maps"
"golang.org/x/exp/slices"
)
// NOTE: the abstractions and APIs here are a first step to further merge

View File

@ -11,6 +11,7 @@ import (
"net/http"
"os"
"path/filepath"
"slices"
"strconv"
"strings"
"time"
@ -40,7 +41,6 @@ import (
v1 "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/sirupsen/logrus"
"golang.org/x/exp/maps"
"golang.org/x/exp/slices"
)
const (

View File

@ -9,6 +9,7 @@ import (
"net"
"os"
"path/filepath"
"slices"
"strconv"
"strings"
"time"
@ -18,7 +19,6 @@ import (
"github.com/containers/common/libnetwork/types"
"github.com/containers/common/libnetwork/util"
"github.com/sirupsen/logrus"
"golang.org/x/exp/slices"
"golang.org/x/sys/unix"
)

View File

@ -7,11 +7,11 @@ import (
"fmt"
"net"
"os"
"slices"
internalutil "github.com/containers/common/libnetwork/internal/util"
"github.com/containers/common/libnetwork/types"
"github.com/sirupsen/logrus"
"golang.org/x/exp/slices"
)
func (n *cniNetwork) NetworkUpdate(_ string, _ types.NetworkUpdateOptions) error {

View File

@ -6,10 +6,10 @@ import (
"fmt"
"io"
"os"
"slices"
"strings"
"github.com/containers/common/pkg/config"
"golang.org/x/exp/slices"
)
const (

View File

@ -3,11 +3,11 @@ package util
import (
"fmt"
"net"
"slices"
"github.com/containers/common/libnetwork/types"
"github.com/containers/common/libnetwork/util"
"github.com/containers/common/pkg/config"
"golang.org/x/exp/slices"
)
func CreateBridge(n NetUtil, network *types.Network, usedNetworks []*net.IPNet, subnetPools []config.SubnetPool) error {

View File

@ -4,11 +4,11 @@ import (
"errors"
"fmt"
"net"
"slices"
"github.com/containers/common/libnetwork/types"
"github.com/containers/common/pkg/config"
"github.com/sirupsen/logrus"
"golang.org/x/exp/slices"
)
// GetBridgeInterfaceNames returns all bridge interface names

View File

@ -10,13 +10,13 @@ import (
"os"
"path/filepath"
"reflect"
"slices"
"strconv"
"time"
internalutil "github.com/containers/common/libnetwork/internal/util"
"github.com/containers/common/libnetwork/types"
"github.com/containers/storage/pkg/stringid"
"golang.org/x/exp/slices"
)
func sliceRemoveDuplicates(strList []string) []string {

View File

@ -5,13 +5,13 @@ package netavark
import (
"encoding/json"
"fmt"
"slices"
"strconv"
"strings"
"github.com/containers/common/libnetwork/internal/util"
"github.com/containers/common/libnetwork/types"
"github.com/sirupsen/logrus"
"golang.org/x/exp/slices"
)
type netavarkOptions struct {

View File

@ -5,12 +5,12 @@ import (
"fmt"
"os"
"path/filepath"
"slices"
"strings"
"github.com/containers/storage/pkg/fileutils"
"github.com/opencontainers/runtime-spec/specs-go"
"github.com/sirupsen/logrus"
"golang.org/x/exp/slices"
)
const (

View File

@ -2,12 +2,12 @@ package util
import (
"fmt"
"slices"
"strings"
"github.com/containers/common/libnetwork/types"
"github.com/containers/common/pkg/filters"
"github.com/containers/common/pkg/util"
"golang.org/x/exp/slices"
)
func GenerateNetworkFilters(f map[string][]string) ([]types.FilterFunc, error) {

View File

@ -8,12 +8,12 @@ package capabilities
import (
"errors"
"fmt"
"slices"
"sort"
"strings"
"sync"
"github.com/syndtr/gocapability/capability"
"golang.org/x/exp/slices"
)
var (

View File

@ -7,6 +7,7 @@ import (
"os/exec"
"path/filepath"
"runtime"
"slices"
"strings"
"github.com/containers/common/internal/attributedstring"
@ -17,7 +18,6 @@ import (
units "github.com/docker/go-units"
selinux "github.com/opencontainers/selinux/go-selinux"
"github.com/sirupsen/logrus"
"golang.org/x/exp/slices"
)
const (

View File

@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"os"
"slices"
"strings"
"github.com/containers/common/internal"
@ -12,7 +13,6 @@ import (
digest "github.com/opencontainers/go-digest"
imgspec "github.com/opencontainers/image-spec/specs-go"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
"golang.org/x/exp/slices"
)
// List is a generic interface for manipulating a manifest list or an image

View File

@ -6,6 +6,7 @@ import (
"errors"
"fmt"
"io"
"slices"
cp "github.com/containers/image/v5/copy"
"github.com/containers/image/v5/image"
@ -15,7 +16,6 @@ import (
multierror "github.com/hashicorp/go-multierror"
digest "github.com/opencontainers/go-digest"
"github.com/sirupsen/logrus"
"golang.org/x/exp/slices"
)
// supplementedImageReference groups multiple references together.

View File

@ -5,12 +5,12 @@ import (
"os"
"path/filepath"
"regexp"
"slices"
"time"
"github.com/containers/storage/pkg/fileutils"
"github.com/fsnotify/fsnotify"
"github.com/sirupsen/logrus"
"golang.org/x/exp/slices"
)
// StringInSlice determines if a string is in a string slice, returns bool.