4 ms·
If you have circular dependencies you're doing something wrong. By disagreeing with that and accepting circular dependencies as a normal state of the Go code, y
by fiatjaf 9y ago
If you have circular dependencies you're doing something wrong. By disagreeing with that and accepting circular dependencies as a normal state of the Go code, you put yourself in the position of doing another wrongness: defining a lot of interfaces.
- sanderjd 9y agoThere is some stuff I really love about Go, but the seemingly pervasive "you're doing that wrong" culture typified by your comment is a really bad look for a language community. It is much better to show people why things are better than to make proclamations. Neither of the things you proclaim to be "wrong" are wrong a priori; show us why your way is better.
- lsaferite 9y agoHaving recently moved into go at work and interfacing with its community, I 100% agree with this. The absolute dogma drives me crazy and makes me not want to deal with the go community at all.
- JepZ 9y agoWell, it might be that I was doing something wrong, but in the end I didn't have circular dependencies anymore, so I was doing right again? (just kidding) ;-) So in fact, I don't like to have circular dependencies in Go either and try to avoid them, so I agree with you on that. But at the same time I like very small and simple packages and sometimes you have to choose: 1. do you build a larger package with everything inside 2. do you build multiple smaller packages with dependencies on each other As I said, in general, I favor the smaller packages and that can lead to circular dependencies, if you are not using interfaces properly.
- fiatjaf 9y agoOk, you have a point. But I still think that you have multiple packages and each one is calling all the other ones, then it doesn't make much sense to have multiple packages at all. I prefer smaller packages too, but currently I'm trying to avoid overmodularizing, specially when a package is too connected to some others and is not going to be used elsewhere.