dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit ceda065bf82a7b0f086da6c5c287e9e7f8e55d95
parent 3e1beab9f32f8bcf6269bca216106341e9cd6f71
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Fri, 29 Dec 2023 22:26:47 -0500

cleanup warnings

Diffstat:
Mpkg/utils/utils.go | 35++++++++++++++++++-----------------
1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go @@ -589,24 +589,24 @@ func MustGetDefaultProjectPath() string { // MinInt returns the minimum int64 value func MinInt[T Ints](vals ...T) T { - min := vals[0] + minV := vals[0] for _, num := range vals { - if num < min { - min = num + if num < minV { + minV = num } } - return min + return minV } // MaxInt returns the minimum int64 value func MaxInt[T Ints](vals ...T) T { - max := vals[0] + maxV := vals[0] for _, num := range vals { - if num > max { - max = num + if num > maxV { + maxV = num } } - return max + return maxV } func Shuffle[T any](s []T) { @@ -907,11 +907,11 @@ func ParseNextDatetimeAt(hourMinSec string, clock clockwork.Clock) (time.Time, e if !hourMinSecRgx.MatchString(hourMinSec) { return time.Time{}, errors.New("invalid format (should be 00:00:00)") } - var hour, min, sec int64 - if n, err := fmt.Sscanf(hourMinSec, "%d:%d:%d", &hour, &min, &sec); err != nil || n != 3 { + var hour, minute, sec int64 + if n, err := fmt.Sscanf(hourMinSec, "%d:%d:%d", &hour, &minute, &sec); err != nil || n != 3 { return time.Time{}, errors.New("invalid format (should be 00:00:00)") } - return GetNextDatetimeAt(hour, min, sec, clock) + return GetNextDatetimeAt(hour, minute, sec, clock) } // GetNextDatetimeAt given a hour, minute, second, returns the next Time object at that time. @@ -943,11 +943,11 @@ func ParsePrevDatetimeAt(hourMinSec string, clock clockwork.Clock) (time.Time, e if !hourMinSecRgx.MatchString(hourMinSec) { return time.Time{}, errors.New("invalid format (should be HH:MM:SS)") } - var hour, min, sec int64 - if n, err := fmt.Sscanf(hourMinSec, "%d:%d:%d", &hour, &min, &sec); err != nil || n != 3 { + var hour, minute, sec int64 + if n, err := fmt.Sscanf(hourMinSec, "%d:%d:%d", &hour, &minute, &sec); err != nil || n != 3 { return time.Time{}, errors.New("invalid format (should be HH:MM:SS)") } - return GetPrevDatetimeAt(hour, min, sec, clock) + return GetPrevDatetimeAt(hour, minute, sec, clock) } // ParsePrevDatetimeAt2 given a string in this format "mm-dd HH:MM:SS" returns the previous Time object at that time. @@ -955,11 +955,11 @@ func ParsePrevDatetimeAt2(monthDayHourMinSec string, clock clockwork.Clock) (tim if !monthDayHourMinSecRgx.MatchString(monthDayHourMinSec) { return time.Time{}, errors.New("invalid format (should be mm-dd HH:MM:SS)") } - var month, day, hour, min, sec int64 - if n, err := fmt.Sscanf(monthDayHourMinSec, "%d-%d %d:%d:%d", &month, &day, &hour, &min, &sec); err != nil || n != 5 { + var month, day, hour, minute, sec int64 + if n, err := fmt.Sscanf(monthDayHourMinSec, "%d-%d %d:%d:%d", &month, &day, &hour, &minute, &sec); err != nil || n != 5 { return time.Time{}, errors.New("invalid format (should be mm-dd HH:MM:SS)") } - return GetPrevDatetimeAt2(month, day, hour, min, sec, clock) + return GetPrevDatetimeAt2(month, day, hour, minute, sec, clock) } // GetPrevDatetimeAt given a hour, minute, second, returns the previous Time object at that time. @@ -1151,6 +1151,7 @@ func (r Renderer) RenderNode(w io.Writer, node *bf.Node, entering bool) bf.WalkS node.Literal = []byte(html2.UnescapeString(string(node.Literal))) case bf.CodeBlock: node.Literal = []byte(html2.UnescapeString(string(node.Literal))) + default: } return r.Base.RenderNode(w, node, entering) }