Always return empty auto_groups if previously were nil (#468)

This commit is contained in:
Misha Bragin 2022-09-13 17:19:03 +02:00 committed by GitHub
parent cd7d1a80c9
commit 6de313070a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -80,6 +80,8 @@ type SetupKey struct {
// Copy copies SetupKey to a new object
func (key *SetupKey) Copy() *SetupKey {
autoGroups := make([]string, 0)
autoGroups = append(autoGroups, key.AutoGroups...)
if key.UpdatedAt.IsZero() {
key.UpdatedAt = key.CreatedAt
}
@ -94,7 +96,7 @@ func (key *SetupKey) Copy() *SetupKey {
Revoked: key.Revoked,
UsedTimes: key.UsedTimes,
LastUsed: key.LastUsed,
AutoGroups: key.AutoGroups,
AutoGroups: autoGroups,
}
}