title: Find all occurrences of strings in a []byte slice
body: <p>I want to find the index of all occurrences of a string contained within a byte array.</p>
  
  
  
  <pre><code>func findAllOccurrences(data []byte, searches []string) map[string][]int {
      var results map[string][]int
  
      for _, search := range searches {
          firstMatch = bytes.Index(data, []byte(search))
          results[search] = append(results[search], firstMatch)
  
          // How do I find subsequent the rest of the matches?
      }
  
      return results
  }
  </code></pre>
  
  <p>Finding the first <code>Index()</code> is simple enough, but how can I find <em>all</em> of them in an idiomatic way without consuming unnecessary memory?</p>