Skip to content

Commit a66aaf9

Browse files
committed
all: use latest syntax
1 parent 2a333b8 commit a66aaf9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+518
-457
lines changed

bugs/3/main.go2

Lines changed: 0 additions & 11 deletions
This file was deleted.

chans/chans.go

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

chans/chans.go2

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import "runtime"
1414
//
1515
// This is a convenient way to exit a goroutine sending values when
1616
// the receiver stops reading them.
17-
func Ranger[type T]() (*Sender[T], *Receiver[T]) {
17+
func Ranger[T any]() (*Sender[T], *Receiver[T]) {
1818
c := make(chan T)
1919
d := make(chan bool)
2020
s := &Sender[T]{values: c, done: d}
@@ -24,7 +24,7 @@ func Ranger[type T]() (*Sender[T], *Receiver[T]) {
2424
}
2525

2626
// A sender is used to send values to a Receiver.
27-
type Sender[type T] struct {
27+
type Sender[T any] struct {
2828
values chan<- T
2929
done <-chan bool
3030
}
@@ -47,7 +47,7 @@ func (s *Sender[T]) Close() {
4747
}
4848

4949
// A Receiver receives values from a Sender.
50-
type Receiver[type T] struct {
50+
type Receiver[T any] struct {
5151
values <-chan T
5252
done chan<- bool
5353
}

chans/lb.go2

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
)
1111

1212
// Fanin implements a generic fan-in for variadic channels.
13-
func Fanin[type T](chans ...<-chan T) <-chan T {
13+
func Fanin[T any](chans ...<-chan T) <-chan T {
1414
buf := 0
1515
for _, ch := range chans {
1616
if len(ch) > buf { buf = len(ch) }
@@ -32,7 +32,7 @@ func Fanin[type T](chans ...<-chan T) <-chan T {
3232
}
3333

3434
// Fanout implements a generic fan-out for variadic channels
35-
func Fanout[type T](randomizer func(max int) int, In <-chan T, Outs ...chan T) {
35+
func Fanout[T any](randomizer func(max int) int, In <-chan T, Outs ...chan T) {
3636
l := len(Outs)
3737
for v := range In {
3838
i := randomizer(l)
@@ -41,6 +41,6 @@ func Fanout[type T](randomizer func(max int) int, In <-chan T, Outs ...chan T) {
4141
}
4242
}
4343

44-
func LB[type T](randomizer func(max int) int, ins []<-chan T, outs []chan T) {
44+
func LB[T any](randomizer func(max int) int, ins []<-chan T, outs []chan T) {
4545
Fanout(randomizer, Fanin(ins...), outs...)
4646
}

chans/lb_test.go

Lines changed: 19 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

constraints/pair.go

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

constraints/pair.go2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
package constraints
66

7-
type Pair[type F1, F2] struct {
7+
type Pair[F1, F2 any] struct {
88
f1 F1
99
f2 F2
1010
}

constraints/string.go

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

constraints/string.go2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ type Stringer interface {
1010
String() string
1111
}
1212

13-
type PrintableStringer[type T Stringer] interface {
14-
T Print()
13+
type PrintableStringer[T Stringer] interface {
14+
Print()
1515
}
1616

1717
type Sequence interface {

constraints/types.go

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)