title: Remove an element of a slice in a struct
body: <p>I have a struct "Guest" which contains metadata of a party guest (a unique ID, name, surname and a list of the unique IDs of the guests who are friends of this guest.</p>
  
  <pre><code>type Guest struct {
      id      int
      name    string
      surname string
      friends []int
  }
  </code></pre>
  
  <p>I have the following code to remove an ID from the list of friends:</p>
  
  <pre><code>func (self Guest) removeFriend(id int) {
      for i, other := range self.friends {
          if other == id {
              self.friends = append(self.friends[:i], self.friends[i+1:]...)
              break
          }
      }
  }
  </code></pre>
  
  <p>The problem is: The element I want to remove is overwritten by the shift of the elements, but the slice does not get shorter. Instead, the last element of the slice is multiplied.</p>
  
  <p>To give an example: <code>guest1.friends</code> is <code>[1,2,3,4,5]</code>. After I call <code>guest1.removeFriend(3)</code>, the result is <code>[1,2,4,5,5]</code> instead of the desired <code>[1,2,4,5]</code>.</p>
  
  <p>So, what am I doing wrong?</p>