In other languages, say, Java, you'd create a file Order.java for your Order class. There's no such convention in Go. You can create a file called order.go containing an Order type, but other types, constants and functions may also be in that file. Go simply doesn't have any restrictions regarding the code structure, and that allows for the best-fitting solution for your use case on the one side but also many possibilities each with their own pros and cons on the other side.
I was more curious about why the leadership is opinionated about error handling, but isn't as opinionated about module conventions.
I understand that in both functional and procedure languages, there is a much larger degree of freedom in how you group together items inside of modules. I haven't done a lot of c programming, but I assume it has very well established patterns for organizing modules by now.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Why is it unopinionated on how to organize types and functions within modules?
In other languages, say, Java, you'd create a file
Order.java
for yourOrder
class. There's no such convention in Go. You can create a file calledorder.go
containing anOrder
type, but other types, constants and functions may also be in that file. Go simply doesn't have any restrictions regarding the code structure, and that allows for the best-fitting solution for your use case on the one side but also many possibilities each with their own pros and cons on the other side.Thanks.
I was more curious about why the leadership is opinionated about error handling, but isn't as opinionated about module conventions.
I understand that in both functional and procedure languages, there is a much larger degree of freedom in how you group together items inside of modules. I haven't done a lot of c programming, but I assume it has very well established patterns for organizing modules by now.