Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

o/i/apparmorprompting: make timestamp time.Time and expiration *time.Time #34

Merged
merged 1 commit into from
Apr 24, 2024

Conversation

olivercalder
Copy link
Owner

Since time.Time values are marshalled as RFC3339Nano by default, there is no reason to explicitly save timestamps and expirations as strings and convert them to time.Time on the fly as necessary. Let the marshaller do this automatically.

As expirations should only be populated when lifespan is "timespan", expirations can be stored as *time.Time, which should be encoded as nil when empty and an expiration timestamp in RFC3339Nano format when non-empty.

…Time

Since `time.Time` values are marshalled as RFC3339Nano by default, there
is no reason to explicitly save timestamps and expirations as strings
and convert them to `time.Time` on the fly as necessary. Let the
marshaller do this automatically.

As expirations should only be populated when lifespan is "timespan",
expirations can be stored as `*time.Time`, which should be encoded as
`nil` when empty and an expiration timestamp in RFC3339Nano format when
non-empty.

Signed-off-by: Oliver Calder <[email protected]>
@olivercalder olivercalder merged commit 615c28e into prompting Apr 24, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant