chore: change interface{} to any (#2818)

* chore: change interface{} to any

* chore: update goctl version to 1.5.0

* chore: update goctl deps
This commit is contained in:
Kevin Wan
2023-01-24 16:32:02 +08:00
committed by GitHub
parent 7e0ac77139
commit ae87114282
221 changed files with 1910 additions and 2207 deletions

View File

@@ -11,7 +11,7 @@ import (
func TestExclusiveCallDo(t *testing.T) {
g := NewSingleFlight()
v, err := g.Do("key", func() (interface{}, error) {
v, err := g.Do("key", func() (any, error) {
return "bar", nil
})
if got, want := fmt.Sprintf("%v (%T)", v, v), "bar (string)"; got != want {
@@ -25,7 +25,7 @@ func TestExclusiveCallDo(t *testing.T) {
func TestExclusiveCallDoErr(t *testing.T) {
g := NewSingleFlight()
someErr := errors.New("some error")
v, err := g.Do("key", func() (interface{}, error) {
v, err := g.Do("key", func() (any, error) {
return nil, someErr
})
if err != someErr {
@@ -40,7 +40,7 @@ func TestExclusiveCallDoDupSuppress(t *testing.T) {
g := NewSingleFlight()
c := make(chan string)
var calls int32
fn := func() (interface{}, error) {
fn := func() (any, error) {
atomic.AddInt32(&calls, 1)
return <-c, nil
}
@@ -79,7 +79,7 @@ func TestExclusiveCallDoDiffDupSuppress(t *testing.T) {
wg.Add(1)
go func(k string) {
<-broadcast // get all goroutines ready
_, err := g.Do(k, func() (interface{}, error) {
_, err := g.Do(k, func() (any, error) {
atomic.AddInt32(&calls, 1)
time.Sleep(10 * time.Millisecond)
return nil, nil
@@ -105,7 +105,7 @@ func TestExclusiveCallDoExDupSuppress(t *testing.T) {
g := NewSingleFlight()
c := make(chan string)
var calls int32
fn := func() (interface{}, error) {
fn := func() (any, error) {
atomic.AddInt32(&calls, 1)
return <-c, nil
}