diff --git a/cache.go b/cache.go index 93ec80d..46d38ee 100644 --- a/cache.go +++ b/cache.go @@ -9,6 +9,7 @@ import ( "time" "github.com/go-redis/redis/v8" + "golang.org/x/sync/singleflight" ) const ( @@ -21,8 +22,22 @@ const ( var errRetry = errors.New("cache: winner failed, retrying") +// waits collapses the concurrent waits for the same Redis client and key in +// this process. Each wait holds one Pub/Sub connection, which go-redis v8 +// dials outside the pool, so one process holds at most one Pub/Sub +// connection per key. It is a package variable because callers can make a +// new Cache for each request. +var waits singleflight.Group + type CacheOptions struct { + // SubscriptionTimeout is the maximum time that a waiter waits for the + // winner to publish the data. After it, the waiter falls back to the miss + // function. Zero means no timeout: the wait then stops only when the + // context of the first waiter is done. SubscriptionTimeout time.Duration + // UnsubscribeAndClose is kept for backward compatibility and has no + // effect: RememberBlocking always unsubscribes and closes its + // subscription. UnsubscribeAndClose bool } @@ -31,8 +46,9 @@ type Cache[Data any] interface { } type cache[Data any] struct { - client *redis.Client - options *CacheOptions + client *redis.Client + options *CacheOptions + newSubscription func(client *redis.Client, channel string) CacheSubscription } type MissFunc[Data any] func(ctx context.Context) (*Data, error) @@ -45,8 +61,9 @@ func NewCache[Data any](client *redis.Client, options *CacheOptions) Cache[Data] } return &cache[Data]{ - client: client, - options: builtOptions, + client: client, + options: builtOptions, + newSubscription: NewCacheSubscription, } } @@ -146,47 +163,69 @@ func (c *cache[Data]) tryPopulatingCache(ctx context.Context, missFn MissFunc[Da return data, nil } +// rememberWait waits for the winner to publish the data of key. Concurrent +// waits for the same client, timeout and key share one subscription. The +// timeout is part of the key, so each caller gets its own timeout. func (c *cache[Data]) rememberWait(ctx context.Context, key string) (*Data, error) { - subscription := NewCacheSubscription(c.client, key) - subscription.Subscribe(ctx) + waitKey := fmt.Sprintf("%p\x00%d\x00%s", c.client, c.options.SubscriptionTimeout, key) + result, err, _ := waits.Do(waitKey, func() (any, error) { + return c.waitForPayload(ctx, key) + }) + if err != nil { + return nil, err + } + payload, ok := result.(string) + if !ok { + return nil, fmt.Errorf("cache: unexpected wait result of type %T", result) + } + if payload == retrySignal { + return nil, errRetry + } - defer func() { - if c.options.UnsubscribeAndClose { - subscription.UnsubscribeAndClose(ctx) + var data Data + if err := json.Unmarshal([]byte(payload), &data); err != nil { + return nil, err + } - return - } - err := subscription.Unsubscribe(ctx) - if err != nil { - log.Println(err) + return &data, nil +} + +// waitForPayload subscribes to key and returns the first payload that is not +// empty. It always unsubscribes and closes the subscription before it +// returns. +func (c *cache[Data]) waitForPayload(ctx context.Context, key string) (string, error) { + waitCtx := ctx + if c.options.SubscriptionTimeout > 0 { + // The other waiters of this key share the wait, so a cancelled first + // waiter must not stop it. The timeout limits the wait. + var cancel context.CancelFunc + waitCtx, cancel = context.WithTimeout(context.WithoutCancel(ctx), c.options.SubscriptionTimeout) + defer cancel() + } + + subscription := c.newSubscription(c.client, key).Subscribe(waitCtx) + defer func() { + if err := subscription.UnsubscribeAndClose(waitCtx); err != nil { + log.Println("cache: subscription cleanup failed:", err) } }() - channel, err := subscription.GetChannel(ctx) + channel, err := subscription.GetChannel(waitCtx) if err != nil { - return nil, err - } - if c.options.SubscriptionTimeout != 0*time.Second { - go func() { - time.Sleep(c.options.SubscriptionTimeout) - subscription.UnsubscribeAndClose(ctx) - }() + return "", err } - for msg := range channel { - if msg.Payload == retrySignal { - return nil, errRetry - } - if msg.Payload != "" { - var u Data - // Unmarshal the data into the user - if err := json.Unmarshal([]byte(msg.Payload), &u); err != nil { - return nil, err + for { + select { + case <-waitCtx.Done(): + return "", fmt.Errorf("cache: waiting for the cache subscription: %w", waitCtx.Err()) + case msg, ok := <-channel: + if !ok { + return "", errors.New("error reading from cache subscription channel") + } + if msg.Payload != "" { + return msg.Payload, nil } - - return &u, nil } } - - return nil, errors.New("error reading from cache subscription channel") } diff --git a/cache_internal_test.go b/cache_internal_test.go new file mode 100644 index 0000000..42c5fad --- /dev/null +++ b/cache_internal_test.go @@ -0,0 +1,232 @@ +package cache_lib + +import ( + "context" + "errors" + "net" + "sync" + "sync/atomic" + "testing" + "testing/synctest" + "time" + + "github.com/go-redis/redis/v8" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +var errDialRefused = errors.New("dial refused") + +// newUnreachableClient returns a client whose connections always fail, as when +// Redis resets the connection or refuses it at its connection limit. It needs +// no network. +func newUnreachableClient(t *testing.T) *redis.Client { + t.Helper() + client := redis.NewClient(&redis.Options{ + Addr: "redis.invalid:6379", + Dialer: func(context.Context, string, string) (net.Conn, error) { + return nil, errDialRefused + }, + MaxRetries: -1, + }) + t.Cleanup(func() { _ = client.Close() }) + + return client +} + +func TestUnsubscribeAndClose_ClosesWhenUnsubscribeFails(t *testing.T) { + for name, cleanup := range map[string]func(context.Context, CacheSubscription) error{ + "UnsubscribeAndClose": func(ctx context.Context, s CacheSubscription) error { return s.UnsubscribeAndClose(ctx) }, + "Unsubscribe": func(ctx context.Context, s CacheSubscription) error { return s.Unsubscribe(ctx) }, + } { + t.Run(name, func(t *testing.T) { + subscription, ok := NewCacheSubscription(newUnreachableClient(t), "key").Subscribe(context.Background()).(*cacheSubscription) + require.True(t, ok) + pubSub := subscription.Subscription + require.NotNil(t, pubSub) + + // Channel starts the go-redis goroutine that redials forever until + // the PubSub is closed. + channel, err := subscription.GetChannel(context.Background()) + require.NoError(t, err) + + // A cancelled request context must not stop the cleanup. + ctx, cancel := context.WithCancel(context.Background()) + cancel() + + err = cleanup(ctx, subscription) + require.ErrorIs(t, err, errDialRefused) + assert.Nil(t, subscription.Subscription) + assert.ErrorIs(t, pubSub.Ping(context.Background()), redis.ErrClosed, "the PubSub must be closed") + + select { + case _, open := <-channel: + assert.False(t, open, "the channel must be closed") + case <-time.After(5 * time.Second): + t.Fatal("the go-redis receive goroutine did not stop") + } + + assert.NoError(t, subscription.UnsubscribeAndClose(context.Background()), "a second call does nothing") + }) + } +} + +func TestUnsubscribeAndClose_ConcurrentCalls(t *testing.T) { + subscription, ok := NewCacheSubscription(newUnreachableClient(t), "key").Subscribe(context.Background()).(*cacheSubscription) + require.True(t, ok) + pubSub := subscription.Subscription + _, err := subscription.GetChannel(context.Background()) + require.NoError(t, err) + + const callers = 16 + var ( + wg sync.WaitGroup + failed atomic.Int32 + ) + for i := range callers { + wg.Go(func() { + var err error + if i%2 == 0 { + err = subscription.UnsubscribeAndClose(context.Background()) + } else { + err = subscription.Unsubscribe(context.Background()) + } + if err != nil { + failed.Add(1) + } + }) + } + wg.Wait() + + assert.Equal(t, int32(1), failed.Load(), "only one call does the cleanup") + assert.Nil(t, subscription.Subscription) + assert.ErrorIs(t, pubSub.Ping(context.Background()), redis.ErrClosed) +} + +// fakeSubscription is a CacheSubscription that does not use Redis. +type fakeSubscription struct { + channel chan *redis.Message + closes atomic.Int32 +} + +func (f *fakeSubscription) Unsubscribe(ctx context.Context) error { + return f.UnsubscribeAndClose(ctx) +} + +func (f *fakeSubscription) UnsubscribeAndClose(context.Context) error { + f.closes.Add(1) + + return nil +} + +func (f *fakeSubscription) Subscribe(context.Context) CacheSubscription { return f } + +func (f *fakeSubscription) GetChannel(context.Context) (<-chan *redis.Message, error) { + return f.channel, nil +} + +func newFakeCache(t *testing.T, timeout time.Duration) (*cache[testData], *fakeSubscription, *atomic.Int32) { + t.Helper() + fake := &fakeSubscription{channel: make(chan *redis.Message, 1)} + subscriptions := &atomic.Int32{} + c := &cache[testData]{ + // The fake does not use the client. The cache uses its address only + // in the key of the shared wait. + client: &redis.Client{}, + options: &CacheOptions{SubscriptionTimeout: timeout}, + newSubscription: func(*redis.Client, string) CacheSubscription { + subscriptions.Add(1) + + return fake + }, + } + + return c, fake, subscriptions +} + +type testData struct { + Value string `json:"value"` +} + +func TestRememberWait_CollapsesConcurrentWaits(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + c, fake, subscriptions := newFakeCache(t, 5*time.Second) + + const waiters = 10 + results := make([]*testData, waiters) + errs := make([]error, waiters) + var wg sync.WaitGroup + for i := range waiters { + wg.Go(func() { + results[i], errs[i] = c.rememberWait(context.Background(), "collapse-key") + }) + } + + // Wait until all waiters block: one in the subscription, the others + // in the shared call. + synctest.Wait() + fake.channel <- &redis.Message{Payload: `{"value":"v"}`} + wg.Wait() + + assert.Equal(t, int32(1), subscriptions.Load(), "one subscription for all waiters") + assert.Equal(t, int32(1), fake.closes.Load(), "the subscription is closed once") + for i := range waiters { + require.NoError(t, errs[i]) + assert.Equal(t, &testData{Value: "v"}, results[i]) + } + }) +} + +func TestRememberWait_DifferentTimeoutsDoNotShareAWait(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + short, _, shortSubscriptions := newFakeCache(t, time.Second) + long, _, longSubscriptions := newFakeCache(t, 3*time.Second) + long.client = short.client + + start := time.Now() + var shortElapsed time.Duration + var shortErr error + var wg sync.WaitGroup + wg.Go(func() { + _, shortErr = short.rememberWait(context.Background(), "timeout-mix-key") + shortElapsed = time.Since(start) + }) + // The short wait starts first, so a shared wait would use its timeout. + synctest.Wait() + + _, longErr := long.rememberWait(context.Background(), "timeout-mix-key") + longElapsed := time.Since(start) + wg.Wait() + + require.ErrorIs(t, shortErr, context.DeadlineExceeded) + require.ErrorIs(t, longErr, context.DeadlineExceeded) + assert.Equal(t, time.Second, shortElapsed) + assert.Equal(t, 3*time.Second, longElapsed) + assert.Equal(t, int32(1), shortSubscriptions.Load()) + assert.Equal(t, int32(1), longSubscriptions.Load()) + }) +} + +func TestRememberWait_TimeoutClosesSubscription(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + c, fake, _ := newFakeCache(t, time.Second) + + start := time.Now() + data, err := c.rememberWait(context.Background(), "timeout-key") + + require.ErrorIs(t, err, context.DeadlineExceeded) + assert.Nil(t, data) + assert.Equal(t, time.Second, time.Since(start)) + assert.Equal(t, int32(1), fake.closes.Load()) + }) +} + +func TestRememberWait_RetrySignal(t *testing.T) { + c, fake, _ := newFakeCache(t, time.Second) + fake.channel <- &redis.Message{Payload: retrySignal} + + _, err := c.rememberWait(context.Background(), "retry-key") + + require.ErrorIs(t, err, errRetry) + assert.Equal(t, int32(1), fake.closes.Load()) +} diff --git a/cache_subscription.go b/cache_subscription.go index 8791781..c468b1d 100644 --- a/cache_subscription.go +++ b/cache_subscription.go @@ -3,10 +3,19 @@ package cache_lib import ( "context" "errors" + "fmt" + "log" + "sync" + "time" "github.com/go-redis/redis/v8" ) +// cleanupTimeout limits the time that the UNSUBSCRIBE command can take. The +// cleanup does not use the deadline or the cancellation of the request +// context, because a cancelled request must still release its connection. +const cleanupTimeout = time.Second + type CacheSubscription interface { Unsubscribe(ctx context.Context) error UnsubscribeAndClose(ctx context.Context) error @@ -15,8 +24,12 @@ type CacheSubscription interface { } type cacheSubscription struct { - channel string - client *redis.Client + channel string + client *redis.Client + + // mu protects Subscription. The cleanup can run from more than one + // goroutine, and only one of them must close the Pub/Sub connection. + mu sync.Mutex Subscription *redis.PubSub } @@ -28,48 +41,72 @@ func NewCacheSubscription(client *redis.Client, channel string) CacheSubscriptio } } +// Unsubscribe unsubscribes from the channel and closes the Pub/Sub +// connection. It is the same as UnsubscribeAndClose: a go-redis v8 PubSub +// dials its own connection outside the pool, and a PubSub that is not closed +// keeps that connection (or dials it again) for the life of the process. func (cs *cacheSubscription) Unsubscribe(ctx context.Context) error { - if cs.Subscription == nil { - return nil - } - err := cs.Subscription.Unsubscribe(ctx, cs.channel) - if err != nil { - return err - } + return cs.UnsubscribeAndClose(ctx) +} +// UnsubscribeAndClose unsubscribes from the channel and always closes the +// Pub/Sub connection, also when the UNSUBSCRIBE command fails. It is safe to +// call more than once and from more than one goroutine: only the first call +// does the cleanup, the other calls return nil. +func (cs *cacheSubscription) UnsubscribeAndClose(ctx context.Context) error { + cs.mu.Lock() + pubSub := cs.Subscription cs.Subscription = nil + cs.mu.Unlock() - return nil + return closePubSub(ctx, pubSub, cs.channel) } -func (cs *cacheSubscription) UnsubscribeAndClose(ctx context.Context) error { - if cs.Subscription == nil { +func closePubSub(ctx context.Context, pubSub *redis.PubSub, channel string) error { + if pubSub == nil { return nil } - err := cs.Subscription.Unsubscribe(ctx, cs.channel) - if err != nil { - return err - } - cs.Subscription.Close() - cs.Subscription = nil + cleanupCtx, cancel := context.WithTimeout(context.WithoutCancel(ctx), cleanupTimeout) + defer cancel() + + var unsubscribeErr, closeErr error + if err := pubSub.Unsubscribe(cleanupCtx, channel); err != nil { + unsubscribeErr = fmt.Errorf("cache: unsubscribe failed: %w", err) + } + if err := pubSub.Close(); err != nil && !errors.Is(err, redis.ErrClosed) { + closeErr = fmt.Errorf("cache: closing the subscription failed: %w", err) + } - return nil + return errors.Join(unsubscribeErr, closeErr) } func (cs *cacheSubscription) Subscribe(ctx context.Context) CacheSubscription { - cs.Subscription = cs.client.Subscribe(ctx, cs.channel) - if cs.Subscription == nil { + pubSub := cs.client.Subscribe(ctx, cs.channel) + if pubSub == nil { panic("no subscription created") } + cs.mu.Lock() + previous := cs.Subscription + cs.Subscription = pubSub + cs.mu.Unlock() + + if err := closePubSub(ctx, previous, cs.channel); err != nil { + log.Println("cache: closing the previous subscription failed:", err) + } + return cs } func (cs *cacheSubscription) GetChannel(ctx context.Context) (<-chan *redis.Message, error) { - if cs.Subscription == nil { + cs.mu.Lock() + pubSub := cs.Subscription + cs.mu.Unlock() + + if pubSub == nil { return nil, errors.New("no subscription") } - return cs.Subscription.Channel(), nil + return pubSub.Channel(), nil } diff --git a/examples/pubsub/go.mod b/examples/pubsub/go.mod index 8c7f09d..b4078ed 100644 --- a/examples/pubsub/go.mod +++ b/examples/pubsub/go.mod @@ -1,6 +1,6 @@ module github.com/pubsub_example -go 1.26 +go 1.26.0 replace github.com/honestbank/cache-lib-go => ./../../ @@ -24,5 +24,6 @@ require ( github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasthttp v1.69.0 // indirect golang.org/x/net v0.56.0 // indirect + golang.org/x/sync v0.24.0 // indirect golang.org/x/sys v0.46.0 // indirect ) diff --git a/examples/pubsub/go.sum b/examples/pubsub/go.sum index 8198ed8..eb84ea7 100644 --- a/examples/pubsub/go.sum +++ b/examples/pubsub/go.sum @@ -47,6 +47,8 @@ github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3i golang.org/x/net v0.0.0-20211029224645-99673261e6eb/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.56.0 h1:Rw8j/hFzGvJUZwNBXnAtf5sVDVt+65SK2C7IxCxZt5o= golang.org/x/net v0.56.0/go.mod h1:D3Ku6r+V6JROoZK144D2XfMHFcMq/0zSfLelVTCFKec= +golang.org/x/sync v0.24.0 h1:iqiDrGoDgyuvAKrhLQthUEzU/R378N78gXbBjxed7oA= +golang.org/x/sync v0.24.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/go.mod b/go.mod index 5cd2ede..18752b9 100644 --- a/go.mod +++ b/go.mod @@ -1,12 +1,12 @@ module github.com/honestbank/cache-lib-go -go 1.26 +go 1.26.0 require ( github.com/go-redis/redis/v8 v8.11.5 github.com/go-redis/redismock/v8 v8.11.5 - github.com/golang/mock v1.6.0 github.com/stretchr/testify v1.8.1 + golang.org/x/sync v0.24.0 ) require ( diff --git a/go.sum b/go.sum index e64f263..4b9f918 100644 --- a/go.sum +++ b/go.sum @@ -16,8 +16,6 @@ github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq github.com/go-redis/redismock/v8 v8.11.5 h1:RJFIiua58hrBrSpXhnGX3on79AU3S271H4ZhRI1wyVo= github.com/go-redis/redismock/v8 v8.11.5/go.mod h1:UaAU9dEe1C+eGr+FHV5prCWIt0hafyPWbGMEWE0UWdA= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= -github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= @@ -59,24 +57,22 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781 h1:DzZ89McO9/gWPsQXS/FVKAlG02ZjaQ6AlZRBimEYOd0= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.24.0 h1:iqiDrGoDgyuvAKrhLQthUEzU/R378N78gXbBjxed7oA= +golang.org/x/sync v0.24.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -88,9 +84,7 @@ golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -101,7 +95,6 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=