We need to keep two things in mind while using the substring operation in Go.
First, the interval provided is based on the number of bytes, not the number of runes.
Second, a substring operation may lead to a memory leak as the resulting substring will share the same backing array as the initial string. The solutions to prevent this case from happening are to perform a string copy manually or to use strings.Clone from Go 1.18.
标签:number,41,substring,leaks,Substrings,mistakes,memory,Go,operation From: https://www.cnblogs.com/zhangzhihui/p/18024845