Remove an element of a slice in a struct [duplicate]
问题 This question already has answers here : How to change struct variable content? (1 answer) Why can't I append to a slice that's the property of a struct in golang? (1 answer) Closed 2 years ago . 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. type Guest struct { id int name string surname string friends []int } I have the following code to remove an ID from the list of