metadata: add comments about Image.CreatedAt
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
parent
94cf2f5099
commit
ff4acdc42e
@ -145,6 +145,10 @@ func (s *imageStore) Create(ctx context.Context, image images.Image) (images.Ima
|
||||
return fmt.Errorf("image %q: %w", image.Name, errdefs.ErrAlreadyExists)
|
||||
}
|
||||
|
||||
// The value of `image.CreatedAt` passed from the caller is discarded here.
|
||||
// Ideally we should return an error when the value is already set.
|
||||
// However, as `image.CreatedAt` is defined as a non-pointer `time.Time`, we can't compare it to nil.
|
||||
// And we can't compare it to `time.Time{}` either, as `time.Time{}` is a proper timestamp (1970-01-01 00:00:00).
|
||||
if tm := epoch.FromContext(ctx); tm != nil {
|
||||
image.CreatedAt = tm.UTC()
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user