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

@@ -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)