News for hackers. Stuff that matters.
Re:How to Use Go Interfaces by fiatjaf on Tuesday March 20, 2018 @12:06AM (#16625982)
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.
Re:How to Use Go Interfaces by sanderjd on Tuesday March 20, 2018 @12:57AM (#16626157)
There 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.
Re:How to Use Go Interfaces by lsaferite on Tuesday March 20, 2018 @08:43AM (#16628004)
Having 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.
Re:How to Use Go Interfaces by JepZ on Tuesday March 20, 2018 @07:12AM (#16627493)
Well, 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.

Re:How to Use Go Interfaces by fiatjaf on Tuesday March 20, 2018 @08:42AM (#16627995)
Ok, 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.