I mentioned a few days ago that pointer arithmetic is possible through the unsafe package. Here’s how to do it.
Package unsafe
…
The function
Addaddslentoptrand returns the updated pointerunsafe.Pointer(uintptr(ptr) + uintptr(len))[Go 1.17]. Thelenargument must be of integer type or an untyped constant. A constantlenargument must be representable by a value of typeint; if it is an untyped constant it is given typeint. The rules for valid uses ofPointerstill apply.
I’m not going to go into when or why you would want to do pointer arithmetic. It’s something you should rarely ever do in Go, so counts as an advanced topic. And one I’m not especially versed in.
Quotes from The Go Programming Language Specification Language version go1.23 (June 13, 2024)