Skip to content

Commit a5b678f

Browse files
author
Max Jonas Werner
committed
more idiomatic way to check size for nil
Signed-off-by: Max Jonas Werner <[email protected]>
1 parent 03fd48a commit a5b678f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

controllers/helmrepository_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,8 @@ func (r *HelmRepositoryReconciler) notify(oldObj, newObj *sourcev1.HelmRepositor
256256
}
257257

258258
humanReadableSize := "unknown size"
259-
if newObj.Status.Artifact.Size != nil {
260-
humanReadableSize = fmt.Sprintf("size %s", units.HumanSize(float64(*newObj.Status.Artifact.Size)))
259+
if size := newObj.Status.Artifact.Size; size != nil {
260+
humanReadableSize = fmt.Sprintf("size %s", units.HumanSize(float64(*size)))
261261
}
262262

263263
var oldChecksum string

0 commit comments

Comments
 (0)