Skip to content

Commit

Permalink
Found x.Sub(time.Now()) instead of time.Until(x)
Browse files Browse the repository at this point in the history
go-lint SCC-S1024

The time.Until helper has the same effect as using x.Sub(time.Now()).
The former is easier to read.

Signed-off-by: Deshi Xiao <[email protected]>
  • Loading branch information
xiaods committed Sep 2, 2023
1 parent 91ffd3d commit e9939ed
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/cli/token/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ func list(app *cli.Context, cfg *cmds.Token) error {
ttl := "<forever>"
expires := "<never>"
if token.Expires != nil {
ttl = duration.ShortHumanDuration(token.Expires.Sub(time.Now()))
ttl = duration.ShortHumanDuration(time.Until(token.Expires.Time))
expires = token.Expires.Format(time.RFC3339)
}

Expand Down

0 comments on commit e9939ed

Please sign in to comment.