Methods in Golang | Intermediate level

Опубликовано: 19 Июнь 2023
на канале: Sreekanth
2,047
73

Explains how methods work in Go, things like method normalization, method value evaluation, gotchas and best practices. It also explains the reasons for choosing between pointer and value receiver.

0:00 Basics of Methods
1:21 Value vs Pointer receivers
2:55 Methods on nil values
3:44 Pass by copy
5:54 Pass by copy with slices
7:58 Method normalization
9:25 Method value evaluation
11:01 Gotcha - calling method in range loop
12:26 New types won't get methods of base type
12:53 Choosing between pointer and value receiver

Intermediate level Golang playlist:    • Memory layout and mechanics of arrays...  

Dave Cheney's blog posts:
https://dave.cheney.net/2016/03/19/sh...
https://dave.cheney.net/2015/11/18/we...

Code review wiki: https://github.com/golang/go/wiki/Cod...