Golang Pointers

From UVOO Tech Wiki
Jump to navigation Jump to search
Because Golang string is a read-only slices of bytes.

However, a pointer to a string (*string) can be nil:

var s *string
s = nil
readonly := "readonly"
s = &readonly
dereference := *s