While checking the implementation for reuseTokenSource to write my own TokenSource I noticed that it is using sync.Mutex to guard the access to saved token. But given the Token (under heavy use) is mostly reused maybe the implementation would benefit from using sync.RWMutex and adding a fast path (leveraging read lock) to Token when token is valid.
I am willing to implement this improvement.
While checking the implementation for
reuseTokenSourceto write my ownTokenSourceI noticed that it is usingsync.Mutexto guard the access to saved token. But given theToken(under heavy use) is mostly reused maybe the implementation would benefit from usingsync.RWMutexand adding a fast path (leveraging read lock) toTokenwhen token is valid.I am willing to implement this improvement.