Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions challenge-01/analyzer/analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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
}
}
Expand All @@ -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
}
}
2 changes: 1 addition & 1 deletion challenge-01/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading