Skip to content
Permalink
Browse files

Fixed handling of non-space whitespace.

  • Loading branch information...
jacobsa committed May 2, 2013
1 parent dbb1b60 commit 094282c447e880ee045ab491aec4d0f0aa969243
Showing with 4 additions and 2 deletions.
  1. BIN samples/wordcount/.mapper.go.swp
  2. +4 −2 samples/wordcount/mapper.go
BIN +0 Bytes (100%) samples/wordcount/.mapper.go.swp
Binary file not shown.
@@ -17,20 +17,22 @@ package main

import (
"bufio"
"bytes"
"fmt"
"io"
"os"
"regexp"
)

var g_wordRegexp *regexp.Regexp = regexp.MustCompile(`\w+`)

type keyVal struct {
key []byte
val []byte
}

func mapEntry(entry keyVal, output chan<- keyVal) {
// Split the line into words.
words := bytes.Split(entry.val, []byte(" "))
words := g_wordRegexp.FindAll(entry.val, -1)
for _, word := range words {
output <- keyVal{word, []byte("1")}
}

0 comments on commit 094282c

Please sign in to comment.
You can’t perform that action at this time.