News for hackers. Stuff that matters.
Re:Stream Processing for Go by pstuart on Thursday January 18, 2018 @02:03PM (#16180205)
One small nit on the Go example code:

  func (wordTotals *WordTotals) Update(word string) {
        total, found := wordTotals.WordTotals[word]
        if !found {
            total = 0
        }
        wordTotals.WordTotals[word] = total + 1
  }
Can be done as:

  func (wordTotals *WordTotals) Update(word string) {
        wordTotals.WordTotals[word] += 1
  }
(thanks to Go default values)

There are no comments on this comment yet.