From 9b5443b34123fe3d3170cc7a0a77acb8417f3235 Mon Sep 17 00:00:00 2001 From: Uriel Fanelli Date: Mon, 14 Aug 2023 19:54:24 +0200 Subject: [PATCH] Safer string compare --- orchestrator.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/orchestrator.go b/orchestrator.go index 8ce60fb..d421690 100644 --- a/orchestrator.go +++ b/orchestrator.go @@ -4,6 +4,7 @@ import ( "fmt" "log" "slices" + "strings" "time" ) @@ -30,7 +31,7 @@ func (mip *AbstractMulticast) IsAlpha(hier string) bool { alpha := mip.HierarchyArray[indexMax] log.Println("Maximum element is :", alpha) log.Println("Array is :", mip.HierarchyArray) - return alpha == hier + return strings.Compare(alpha, hier) == 0 }