Skip to content

Instantly share code, notes, and snippets.

@lamarmarshall
Created October 26, 2017 00:39
Show Gist options
  • Save lamarmarshall/1252260bb938dcd2a3f64cb20029f956 to your computer and use it in GitHub Desktop.
Save lamarmarshall/1252260bb938dcd2a3f64cb20029f956 to your computer and use it in GitHub Desktop.
go delete element from slice
delete := func(a []int, index int) []int {
last := index + 1
a = append(a[:index], a[last:]...)
return a
}
fmt.Println("deleted ", delete(sls, 2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment