From 9fd4f8131a311e9986689fa2f27b3ba3bfc009be Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Wed, 6 Dec 2023 16:55:59 +0000 Subject: [PATCH] initialize lowest to maxint --- day-5/one.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/day-5/one.go b/day-5/one.go index 8fda1e8..796ef11 100644 --- a/day-5/one.go +++ b/day-5/one.go @@ -1,6 +1,8 @@ package main import ( + "math" + log "github.com/sirupsen/logrus" ) @@ -31,15 +33,12 @@ func next(i int, datapoint int) int { // one returns the lowest location func one(lines []string) (int, error) { - lowest := 0 + lowest := math.MaxInt parseLines(lines) for _, seed := range seeds { location := next(0, seed) log.Info(location) - if lowest == 0 { - lowest = location - } if location < lowest { lowest = location }