fix(token-list): expiration time can be null
Description
On self-managed instances tokens don't have to have an expiration period. This is because in https://docs.gitlab.com/administration/raketasks/tokens/#remove-expiration-dates we explain how to remove this limitation.
This in turn causes the tool to panic when trying to call .String() on a null value.
The fix is simple, simply check if the actual value is not nil before trying to call .String().
- fix(token-list): expiration time can be null
Related Issues
Closes #7779 (closed)
How has this been tested?
/ # ./glab token list --user root | tail -3
5 token-without-expiration - true false 2025-02-19T14:51:58Z - - api,create_runner
6 glab - true false 2025-02-19T14:53:51Z - - api,read_api,read_user,read_repository,write_repository,read_registry,write_registry,admin_mode
7 glab-token-with-expiration - true false 2025-02-19T14:55:13Z 2025-03-31 2025-02-19T14:55:23Z api,read_api,read_user
Screenshots (if appropriate):
Types of changes
-
Bug fix (non-breaking change which fixes an issue) -
New feature (non-breaking change which adds functionality) -
Breaking change (fix or feature that would cause existing functionality to change) -
Documentation -
Chore (Related to CI or Packaging to platforms) -
Test gap