Skip to content

Instantly share code, notes, and snippets.

@olehcambel
Created March 25, 2020 20:24
Show Gist options
  • Save olehcambel/73b51ec3dc6f47af087a16a4648d8304 to your computer and use it in GitHub Desktop.
Save olehcambel/73b51ec3dc6f47af087a16a4648d8304 to your computer and use it in GitHub Desktop.
go copy impl
func copy(dst, src []T) int {
for i := range dst {
src[i] = dst[i]
}
return cap(dst) - cap(src)
}
t := make([]byte, len(s), (cap(s)+1)*2)
copy(t, s)
s = t
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment