Skip to content

Instantly share code, notes, and snippets.

@richardlehane
Created February 11, 2016 23:48
Show Gist options
  • Select an option

  • Save richardlehane/5c86856aa83f1e8565fb to your computer and use it in GitHub Desktop.

Select an option

Save richardlehane/5c86856aa83f1e8565fb to your computer and use it in GitHub Desktop.
func deletefromslice(n int, slice []byte) []byte {
if n >= len(slice) {
return nil
}
return slice[n:]
}
// http://blog.golang.org/go-slices-usage-and-internals - is a great read for getting your head around slices!
// if reflect.DeepEqual(needle, haystack[:nlen])
// best to avoid reflect package unless really need it
// the bytes package has a bytes.Equal func you could use here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment