Snippet Golang: removing nth element in an array
```
package main
import "fmt"
type Temporary struct { Event string ID uint }
var tmp = []Temporary{ Temporary{ Event: "red", ID: 2, }, Temporary{ Event: "blue", ID: 3, }, Temporary{ Event: "black", ID: 4, }, Temporary{ Event: "pink", ID: 5, }, }
func Release(id uint) {
loop: for i, x := range tmp { if x.ID == id { copy(tmp[i:], tmp[i+1:]) tmp = tmp[:len(tmp)-1] goto loop } } }
func main() { fmt.Println("1:", tmp)Release(4) fmt.Println("2:", tmp)
} ```











