Nice content dude! As a general rule, to make your code more flexible and to explicitly declare what functionality is being used, your functions should accept interfaces and return structs. Exception to this is returning the error interface
@PeterBenjamin-KH Жыл бұрын
These are the times when I feel like I want proper enums in Go. There is Go proposal for proper enums in Go, but there is no consensus from the team or the community. For now, there is "enumer" utility (designed following Rob Pike's "stringer" utility) that scaffolds/generates the boilerplate that you just typed in this video. 🙂
@brianmmdev Жыл бұрын
I agree. Ive resorted to using specially named constants but it’s not the same.