
How to make mistakes in Go
Go Time: Golang, Software Engineering
00:00
Is There a Multi Error?
In our validate function, what one guy could do in that case is to say, first, I'm going to create a variable called result. It's going to be a pointer to multi error. So I write var result, star multi error, right? And by default, result is going to be assigned to nil as the zero value of a pointer is nil,. But if there is no error, actually, what we are going to return is a nil receiver, not a nil value directly. As the return type was an interface, because we return a neural interface, We didn't return a nil value here. We return an interface implemented by a nil receiver which is actually different from nil
Play episode from 06:55
Transcript


