Hi, https://go.dev/doc/faq#methods_on_values_or_pointers
>First, and most important, does the method need to modify the receiver? If it >does, the receiver must be a pointer. (Slices and maps act as references, so >their story is a little more subtle, but for instance to change the length of >a slice in a method the receiver must still be a pointer.) In the examples >above, if pointerMethod modifies the fields of s, the caller will see those >changes, but valueMethod is called with a copy of the caller's argument >(that's the definition of passing a value), so changes it makes will be >invisible to the caller. You have a non pointer receiver, you modify a copy. Cheers, Reto -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/20211206070034.eax4ndyyquydewru%40feather.