Skip to content

Commit

Permalink
Replace golang.org/x/exp with stdlib
Browse files Browse the repository at this point in the history
The experimental functions in `golang.org/x/exp` are now
available in the standard library in Go 1.21.

Reference: https://go.dev/doc/go1.21#slices
Reference: https://go.dev/doc/go1.21#cmp
Signed-off-by: Eng Zer Jun <[email protected]>
  • Loading branch information
Juneezee committed Jan 22, 2025
1 parent 34d54b9 commit e82121a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ require (
go.uber.org/zap v1.27.0
go.uber.org/zap/exp v0.3.0
golang.org/x/crypto v0.32.0
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8
golang.org/x/mod v0.22.0
golang.org/x/net v0.34.0
golang.org/x/sync v0.10.0
Expand Down Expand Up @@ -122,6 +121,7 @@ require (
go.opentelemetry.io/otel/trace v1.33.0 // indirect
go.uber.org/mock v0.5.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8 // indirect
golang.org/x/sys v0.29.0 // indirect
golang.org/x/text v0.21.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250115164207-1a7da9e5054f // indirect
Expand Down
5 changes: 2 additions & 3 deletions private/buf/bufwkt/cmd/wkt-go-data/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package main

import (
"bytes"
"cmp"
"context"
"errors"
"fmt"
Expand All @@ -25,8 +26,6 @@ import (
"sort"
"strings"

"golang.org/x/exp/constraints"

"github.com/bufbuild/buf/private/bufpkg/bufanalysis"
"github.com/bufbuild/buf/private/bufpkg/bufimage"
"github.com/bufbuild/buf/private/bufpkg/bufmodule"
Expand Down Expand Up @@ -400,7 +399,7 @@ type keyValPair[K any, V any] struct {
val V
}

func sortedPairs[K constraints.Ordered, V any](m map[K]V) []keyValPair[K, V] {
func sortedPairs[K cmp.Ordered, V any](m map[K]V) []keyValPair[K, V] {
ret := make([]keyValPair[K, V], 0, len(m))
for key := range m {
ret = append(ret, keyValPair[K, V]{key: key, val: m[key]})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ package internal

import (
"sort"

"golang.org/x/exp/slices"
"slices"
)

// fieldOptionsTrie stores paths to FieldOptions (tag 8 of a FieldDescriptorProto).
Expand Down

0 comments on commit e82121a

Please sign in to comment.