Can someone help me understand how `bytealg.MakeNoZero()` in the Go standard library works, please?
In the source it is a `func` without a body, and in my own code that won't compile in Go; I get "missing function body." Where is its implementation and how does the Go compiler handle it?
I discovered `bytealg.MakeNoZero()` looking into the source for `strings.Builder`:
I was considering following the advice in Go Proverbs that "A little copying is better than a little dependency" but I obviously found that I cannot copy it to my own package and compile it, at least not as-is.
I wanted to create my own version of `strings.Builder` that has a `Rewind()` method to allow slicing one or more characters from the internal `buf` buffer, e.g.:
func (b *StringBuilder) Rewind(n int) {
if n > len(b.buf) {
n = len(b.buf)
}
b.buf = b.buf[:len(b.buf)-n]
}
I could of course modify the code of `strings.Builder` to replace `bytealg.MakeNoZero()` but then I would have a less performant string builder, especially for larger strings:
Any insight into `bytealg.MakeNoZero()` would be appreciated.
-Mike