From 17ab6d71443688765c640a0cf7cab3cf4b133af4 Mon Sep 17 00:00:00 2001 From: David Ashby Date: Tue, 22 Dec 2020 20:06:29 -0500 Subject: [PATCH] ok fine --- 21/main.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/21/main.go b/21/main.go index 9913102..3ef3351 100644 --- a/21/main.go +++ b/21/main.go @@ -132,7 +132,9 @@ func partTwo() { } } - // formatting the result correctly is left as an exercise for the reader - // because I don't want to deal with go's map order randomization - fmt.Println(trueAllergens) + formatted := "" // in theory we shouldn't hard-code this allergen order... + for _, a := range []string{"dairy", "eggs", "fish", "nuts", "peanuts", "sesame", "soy", "wheat"} { + formatted = formatted + trueAllergens[a] + "," + } + fmt.Println(strings.TrimSuffix(formatted, ",")) }