mirror of
https://github.com/kubernetes/client-go.git
synced 2025-06-23 13:47:19 +00:00
Merge pull request #59727 from wgliang/master.time
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. should use time.Since instead of time.Now().Sub **What this PR does / why we need it**: should use time.Since instead of time.Now().Sub **Special notes for your reviewer**: Kubernetes-commit: 7eb88f11d23d2be7dc3a91f727a1a77a0abac5e8
This commit is contained in:
commit
b4efb2d46b
@ -95,7 +95,7 @@ func (c *cachedGetter) Token() (string, error) {
|
|||||||
|
|
||||||
var err error
|
var err error
|
||||||
// no token or exceeds the TTL
|
// no token or exceeds the TTL
|
||||||
if c.token == "" || time.Now().Sub(c.born) > c.ttl {
|
if c.token == "" || time.Since(c.born) > c.ttl {
|
||||||
c.token, err = c.tokenGetter.Token()
|
c.token, err = c.tokenGetter.Token()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("failed to get token: %s", err)
|
return "", fmt.Errorf("failed to get token: %s", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user