title: Go: split byte.Buffer by newline
body: <p>Pretty new to Go and running into a problem like:</p>
  
  <pre><code>var metrics bytes.Buffer
  
  metrics.WriteString("foo")
  metrics.WriteString("\n")
  
  metrics.WriteString("bar")
  metrics.WriteString("\n")
  </code></pre>
  
  <p>Now I want to cycle through that metrics and split by newline. I tried</p>
  
  <pre><code>for m := strings.Split(metrics.String(), "\n") {
       log.Printf("metric: %s", m)
  }
  </code></pre>
  
  <p>but I get the following</p>
  
  <pre><code>./relay.go:71: m := strings.Split(metrics.String(), "\n") used as value
  </code></pre>