title: How to get single items count in a slice with go?
body: <p>For example, this is a slice:</p>
  
  <pre><code>[1, 2, 3, 3, 4]
  </code></pre>
  
  <p>want to get single data <code>1, 2, 4</code> 's count and return <code>count = 3</code>.</p>
  
  <p>Maybe remove duplicate items(include itself) is an idea, but didn't find suitalbe method.</p>
  
  <hr>
  
  <p>What I tried:</p>
  
  <pre><code>  func removeDuplicateItems() {
        intSlice := []int{1, 2, 3, 3, 4}
        fmt.Println(intSlice)
  
        keys := make(map[int]bool)
        list := []int{}
        for _, entry := range intSlice {
            if _, value := keys[entry]; !value {
                keys[entry] = true
                list = append(list, entry)
            }
        }
  
        fmt.Println(list)
    }
  </code></pre>
  
  <p>Got</p>
  
  <pre><code>[1 2 3 3 4]
  [1 2 3 4]
  </code></pre>