From dbf71f4a619bef901769c855e6208bf2c8e4ba82 Mon Sep 17 00:00:00 2001 From: Priyansh Sao Date: Wed, 27 May 2026 14:51:47 +0530 Subject: [PATCH] fix(analyzer): remove String method from map Signed-off-by: Priyansh Sao --- challenge-01/analyzer/analyzer.go | 8 ++++---- challenge-01/config/config.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/challenge-01/analyzer/analyzer.go b/challenge-01/analyzer/analyzer.go index 70ce990..6557f76 100644 --- a/challenge-01/analyzer/analyzer.go +++ b/challenge-01/analyzer/analyzer.go @@ -49,13 +49,13 @@ func Process(config *stdconfig.Config) error { func processBytes(buffer []byte, result *stdconfig.Result) { if len(buffer) > 0 { - (*result)[stdconfig.BYTES.String()] += len(buffer) + (*result)[stdconfig.BYTES] += len(buffer) } } func processLines(buffer []byte, result *stdconfig.Result) { - (*result)[stdconfig.LINES.String()] += bytes.Count(buffer, []byte{'\n'}) + (*result)[stdconfig.LINES] += bytes.Count(buffer, []byte{'\n'}) } func processWords(buffer []byte, result *stdconfig.Result, inWord *bool) { @@ -66,7 +66,7 @@ func processWords(buffer []byte, result *stdconfig.Result, inWord *bool) { } else { if !*inWord { - (*result)[stdconfig.WORDS.String()]++ + (*result)[stdconfig.WORDS]++ *inWord = true } } @@ -93,7 +93,7 @@ func processRunes(buffer []byte, result *stdconfig.Result, leftOver *[]byte) { // as we are sure there is atleast 1 rune ahed _, size := utf8.DecodeRune(buffer[i:]) - (*result)[stdconfig.RUNES.String()]++ + (*result)[stdconfig.RUNES]++ i += size } } diff --git a/challenge-01/config/config.go b/challenge-01/config/config.go index 5442296..e6fcd79 100644 --- a/challenge-01/config/config.go +++ b/challenge-01/config/config.go @@ -8,7 +8,7 @@ type FileOpts int type Opts map[FileOpts]bool // Result stores the computed values for each option. -type Result map[string]int +type Result map[FileOpts]int const ( // BYTES represents the byte count operation.