Merge pull request #13403 from machine424/slices

Move from golang.org/x/exp/slices into slices
This commit is contained in:
Björn Rabenstein 2024-02-28 15:31:18 +01:00 committed by GitHub
commit 0824e6e4ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
36 changed files with 37 additions and 41 deletions

View file

@ -64,6 +64,8 @@ linters-settings:
desc: "Use github.com/klauspost/compress instead of gzip"
- pkg: "zlib"
desc: "Use github.com/klauspost/compress instead of zlib"
- pkg: "golang.org/x/exp/slices"
desc: "Use 'slices' instead."
errcheck:
exclude-functions:
# Don't flag lines such as "io.Copy(io.Discard, resp.Body)".

View file

@ -23,6 +23,7 @@ import (
"path/filepath"
"runtime"
"runtime/pprof"
"slices"
"strconv"
"strings"
"sync"
@ -31,7 +32,6 @@ import (
"github.com/alecthomas/units"
"github.com/go-kit/log"
"golang.org/x/exp/slices"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/promql/parser"

2
go.mod
View file

@ -74,7 +74,7 @@ require (
go.uber.org/automaxprocs v1.5.3
go.uber.org/goleak v1.3.0
go.uber.org/multierr v1.11.0
golang.org/x/exp v0.0.0-20240119083558-1b970713d09a
golang.org/x/exp v0.0.0-20240119083558-1b970713d09a // indirect
golang.org/x/net v0.21.0
golang.org/x/oauth2 v0.16.0
golang.org/x/sync v0.6.0

View file

@ -15,10 +15,10 @@ package histogram
import (
"math"
"slices"
"testing"
"github.com/stretchr/testify/require"
"golang.org/x/exp/slices"
)
func TestGetBound(t *testing.T) {

View file

@ -16,9 +16,8 @@ package histogram
import (
"fmt"
"math"
"slices"
"strings"
"golang.org/x/exp/slices"
)
// CounterResetHint contains the known information about a counter reset,

View file

@ -17,10 +17,10 @@ package labels
import (
"bytes"
"slices"
"strings"
"github.com/cespare/xxhash/v2"
"golang.org/x/exp/slices"
)
// Labels is a sorted set of labels. Order has to be guaranteed upon

View file

@ -16,10 +16,10 @@ package labels
import (
"bytes"
"encoding/json"
"slices"
"strconv"
"github.com/prometheus/common/model"
"golang.org/x/exp/slices"
)
const (

View file

@ -17,12 +17,12 @@ package labels
import (
"bytes"
"slices"
"strings"
"sync"
"unsafe"
"github.com/cespare/xxhash/v2"
"golang.org/x/exp/slices"
)
// Labels is implemented by a SymbolTable and string holding name/value

View file

@ -17,11 +17,11 @@ package labels
import (
"reflect"
"slices"
"strings"
"unsafe"
"github.com/cespare/xxhash/v2"
"golang.org/x/exp/slices"
)
// Labels is implemented by a single flat string holding name/value pairs.

View file

@ -22,6 +22,7 @@ import (
"math"
"reflect"
"runtime"
"slices"
"sort"
"strconv"
"strings"
@ -36,7 +37,6 @@ import (
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace"
"golang.org/x/exp/slices"
"github.com/prometheus/prometheus/model/histogram"
"github.com/prometheus/prometheus/model/labels"

View file

@ -16,6 +16,7 @@ package promql
import (
"fmt"
"math"
"slices"
"sort"
"strconv"
"strings"
@ -24,7 +25,6 @@ import (
"github.com/facette/natsort"
"github.com/grafana/regexp"
"github.com/prometheus/common/model"
"golang.org/x/exp/slices"
"github.com/prometheus/prometheus/model/histogram"
"github.com/prometheus/prometheus/model/labels"

View file

@ -15,10 +15,9 @@ package promql
import (
"math"
"slices"
"sort"
"golang.org/x/exp/slices"
"github.com/prometheus/prometheus/model/histogram"
"github.com/prometheus/prometheus/model/labels"
)

View file

@ -17,12 +17,12 @@ import (
"context"
"errors"
"math"
"slices"
"strings"
"sync"
"time"
"go.uber.org/atomic"
"golang.org/x/exp/slices"
"github.com/prometheus/prometheus/promql/parser"

View file

@ -18,6 +18,7 @@ import (
"errors"
"fmt"
"net/url"
"slices"
"strings"
"sync"
"time"
@ -25,7 +26,6 @@ import (
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/prometheus/client_golang/prometheus"
"golang.org/x/exp/slices"
"golang.org/x/sync/semaphore"
"github.com/prometheus/prometheus/model/labels"

View file

@ -23,6 +23,7 @@ import (
"math"
"net/http"
"reflect"
"slices"
"strconv"
"strings"
"sync"
@ -34,7 +35,6 @@ import (
config_util "github.com/prometheus/common/config"
"github.com/prometheus/common/model"
"github.com/prometheus/common/version"
"golang.org/x/exp/slices"
"github.com/prometheus/prometheus/config"
"github.com/prometheus/prometheus/discovery/targetgroup"

View file

@ -19,10 +19,9 @@ import (
"context"
"fmt"
"math"
"slices"
"sync"
"golang.org/x/exp/slices"
"github.com/prometheus/prometheus/model/histogram"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/tsdb/chunkenc"

View file

@ -20,6 +20,7 @@ import (
"io"
"math"
"net/http"
"slices"
"sort"
"strings"
"sync"
@ -28,7 +29,6 @@ import (
"github.com/golang/snappy"
"github.com/prometheus/common/model"
"go.opentelemetry.io/collector/pdata/pmetric/pmetricotlp"
"golang.org/x/exp/slices"
"github.com/prometheus/prometheus/model/exemplar"
"github.com/prometheus/prometheus/model/histogram"

View file

@ -17,13 +17,13 @@ import (
"context"
"errors"
"net/http"
"slices"
"strings"
"sync"
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/prometheus/client_golang/prometheus"
"golang.org/x/exp/slices"
"github.com/prometheus/prometheus/config"
"github.com/prometheus/prometheus/model/labels"

View file

@ -22,12 +22,12 @@ import (
"io"
"os"
"path/filepath"
"slices"
"sync"
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/oklog/ulid"
"golang.org/x/exp/slices"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/storage"

View file

@ -23,13 +23,13 @@ import (
"io"
"os"
"path/filepath"
"slices"
"strconv"
"sync"
"github.com/dennwc/varint"
"github.com/prometheus/client_golang/prometheus"
"go.uber.org/atomic"
"golang.org/x/exp/slices"
"github.com/prometheus/prometheus/tsdb/chunkenc"
tsdb_errors "github.com/prometheus/prometheus/tsdb/errors"

View file

@ -21,13 +21,13 @@ import (
"io"
"os"
"path/filepath"
"slices"
"time"
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/oklog/ulid"
"github.com/prometheus/client_golang/prometheus"
"golang.org/x/exp/slices"
"github.com/prometheus/prometheus/storage"
"github.com/prometheus/prometheus/tsdb/chunkenc"

View file

@ -23,6 +23,7 @@ import (
"math"
"os"
"path/filepath"
"slices"
"strconv"
"strings"
"sync"
@ -33,7 +34,6 @@ import (
"github.com/oklog/ulid"
"github.com/prometheus/client_golang/prometheus"
"go.uber.org/atomic"
"golang.org/x/exp/slices"
"golang.org/x/sync/errgroup"
"github.com/prometheus/prometheus/config"

View file

@ -16,11 +16,11 @@ package tsdb
import (
"context"
"errors"
"slices"
"sync"
"unicode/utf8"
"github.com/prometheus/client_golang/prometheus"
"golang.org/x/exp/slices"
"github.com/prometheus/prometheus/config"
"github.com/prometheus/prometheus/model/exemplar"

View file

@ -18,10 +18,10 @@ import (
"errors"
"fmt"
"math"
"slices"
"sync"
"github.com/go-kit/log/level"
"golang.org/x/exp/slices"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/storage"

View file

@ -25,11 +25,10 @@ import (
"math"
"os"
"path/filepath"
"slices"
"sort"
"unsafe"
"golang.org/x/exp/slices"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/storage"
"github.com/prometheus/prometheus/tsdb/chunks"

View file

@ -20,12 +20,12 @@ import (
"fmt"
"math"
"runtime"
"slices"
"sort"
"strings"
"sync"
"github.com/bboreham/go-loser"
"golang.org/x/exp/slices"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/storage"

View file

@ -15,8 +15,7 @@ package index
import (
"math"
"golang.org/x/exp/slices"
"slices"
)
// Stat holds values for a single cardinality statistic.

View file

@ -17,9 +17,9 @@ import (
"context"
"errors"
"math"
"slices"
"github.com/oklog/ulid"
"golang.org/x/exp/slices"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/storage"

View file

@ -17,12 +17,12 @@ import (
"context"
"fmt"
"math"
"slices"
"sort"
"testing"
"time"
"github.com/stretchr/testify/require"
"golang.org/x/exp/slices"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/storage"

View file

@ -18,11 +18,11 @@ import (
"errors"
"fmt"
"math"
"slices"
"strings"
"unicode/utf8"
"github.com/oklog/ulid"
"golang.org/x/exp/slices"
"github.com/prometheus/prometheus/model/histogram"
"github.com/prometheus/prometheus/model/labels"

View file

@ -21,12 +21,12 @@ import (
"math"
"os"
"path/filepath"
"slices"
"strconv"
"strings"
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"golang.org/x/exp/slices"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/tsdb/chunks"

View file

@ -20,6 +20,7 @@ import (
"math"
"os"
"path/filepath"
"slices"
"strconv"
"strings"
"time"
@ -27,7 +28,6 @@ import (
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/prometheus/client_golang/prometheus"
"golang.org/x/exp/slices"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/model/timestamp"

View file

@ -23,6 +23,7 @@ import (
"io"
"os"
"path/filepath"
"slices"
"strconv"
"sync"
"time"
@ -32,7 +33,6 @@ import (
"github.com/golang/snappy"
"github.com/klauspost/compress/zstd"
"github.com/prometheus/client_golang/prometheus"
"golang.org/x/exp/slices"
"github.com/prometheus/prometheus/tsdb/fileutil"
)

View file

@ -16,9 +16,8 @@ package stats
import (
"bytes"
"fmt"
"slices"
"time"
"golang.org/x/exp/slices"
)
// A Timer that can be started and stopped and accumulates the total time it

View file

@ -24,6 +24,7 @@ import (
"net/url"
"os"
"path/filepath"
"slices"
"sort"
"strconv"
"strings"
@ -37,7 +38,6 @@ import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/model"
"github.com/prometheus/common/route"
"golang.org/x/exp/slices"
"github.com/prometheus/prometheus/config"
"github.com/prometheus/prometheus/model/labels"

View file

@ -17,6 +17,7 @@ import (
"errors"
"fmt"
"net/http"
"slices"
"sort"
"strings"
@ -26,7 +27,6 @@ import (
dto "github.com/prometheus/client_model/go"
"github.com/prometheus/common/expfmt"
"github.com/prometheus/common/model"
"golang.org/x/exp/slices"
"github.com/prometheus/prometheus/model/histogram"
"github.com/prometheus/prometheus/model/labels"