3 ms·
Ironically you can make nullsafe methods in Go type X struct{} func (x *X) y() {} func main() { var x *X = nil x.y() // no error }
by cdoxsey 8y ago
Ironically you can make nullsafe methods in Go
type X struct{}
func (x *X) y() {}
func main() {
var x *X = nil
x.y() // no error
}
Also its not unsafe. Go doesn't allow unsafe memory access unless you use the unsafe package.
It is incorrect though. An Go does allow you to write bugs.