title: Filtering a slice of structs based on a different slice in Golang
body: <p>In the example code below, I have a few users in <code>manySimpleUsers</code> that I would like to remove from <code>manyFullUsers</code> based on the Username.</p>
  
  <p>If I do it with a nested couple of <code>for... range</code> loops, there will be many cycles required to filter all of the elements, especially when there are large numbers of elements in both Slices.</p>
  
  <p>What is the best way to achieve this in Go? </p>
  
  <pre><code>package main
  
  import "fmt"
  
  func main() {
      fmt.Println("Hello, playground")
  
      type FullUser struct {
          UserName  string
          UserEmail string
      }
  
      manyFullUsers := []FullUser{{"foo", "foo@jawohl.com"},
          {"bar", "bar@jawohl.com"},
          {"baz", "baz@jawohl.com"}}
  
      type SimpleUser struct {
          UserName string
      }
  
      manySimpleUsers := []SimpleUser{{"foo"}, {"bar"}}
  
      fmt.Println(manyFullUsers)
      fmt.Println(manySimpleUsers)
  }
  </code></pre>