diff --git a/metadata/images.go b/metadata/images.go index 4f074dc05..ff5b624cc 100644 --- a/metadata/images.go +++ b/metadata/images.go @@ -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 {