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:
@@ -10,13 +10,13 @@ type (
|
||||
// A ------->calls F with key<------------------->returns val
|
||||
// B --------------------->calls F with key------>returns val
|
||||
SingleFlight interface {
|
||||
Do(key string, fn func() (interface{}, error)) (interface{}, error)
|
||||
DoEx(key string, fn func() (interface{}, error)) (interface{}, bool, error)
|
||||
Do(key string, fn func() (any, error)) (any, error)
|
||||
DoEx(key string, fn func() (any, error)) (any, bool, error)
|
||||
}
|
||||
|
||||
call struct {
|
||||
wg sync.WaitGroup
|
||||
val interface{}
|
||||
val any
|
||||
err error
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ func NewSingleFlight() SingleFlight {
|
||||
}
|
||||
}
|
||||
|
||||
func (g *flightGroup) Do(key string, fn func() (interface{}, error)) (interface{}, error) {
|
||||
func (g *flightGroup) Do(key string, fn func() (any, error)) (any, error) {
|
||||
c, done := g.createCall(key)
|
||||
if done {
|
||||
return c.val, c.err
|
||||
@@ -43,7 +43,7 @@ func (g *flightGroup) Do(key string, fn func() (interface{}, error)) (interface{
|
||||
return c.val, c.err
|
||||
}
|
||||
|
||||
func (g *flightGroup) DoEx(key string, fn func() (interface{}, error)) (val interface{}, fresh bool, err error) {
|
||||
func (g *flightGroup) DoEx(key string, fn func() (any, error)) (val any, fresh bool, err error) {
|
||||
c, done := g.createCall(key)
|
||||
if done {
|
||||
return c.val, false, c.err
|
||||
@@ -69,7 +69,7 @@ func (g *flightGroup) createCall(key string) (c *call, done bool) {
|
||||
return c, false
|
||||
}
|
||||
|
||||
func (g *flightGroup) makeCall(c *call, key string, fn func() (interface{}, error)) {
|
||||
func (g *flightGroup) makeCall(c *call, key string, fn func() (any, error)) {
|
||||
defer func() {
|
||||
g.lock.Lock()
|
||||
delete(g.calls, key)
|
||||
|
||||
Reference in New Issue
Block a user