title: Trying to add only unique elements to array
body: <p>I'm trying to keep track of all the "workers" that I have in an array. <code>m</code> is a struct that has a string field uuid and so does <code>args</code>. I'm not sure what is wrong here but the code is adding the workers with the same uuid again and again (as and when the code is called).</p>
  
  <p>Any help would be appreciated.</p>
  
  <p>P.S: This code might be called concurrently (but the code is mutex-locked so it doesn't really matter)</p>
  
  <pre><code>    var pollingWrkr *Wrkr
      pollingWrkr = nil
      for idx, w := range m.workers {
          if w.uuid == args.WorkerUUID {
              pollingWrkr = &amp;m.workers[idx]
              break
          }
      }
  
      // add new worker
      if pollingWrkr == nil {
          pollingWrkr = new(Wrkr)
          m.workers = append(m.workers, *pollingWrkr) // add worker to list
          log.Printf("worker %v added\n", args.WorkerUUID)
      }
  </code></pre>