Created
February 11, 2016 23:48
-
-
Save richardlehane/5c86856aa83f1e8565fb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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