Kurtis has given some great answers about the general problem. I do have a 
bit of a counterpoint to this statement, however:

> > As a learning exercise I'm converting a large app into Go. 
>
> That's going to be a painful way to learn Go. Worse, doing a 
straightforward, mechanical, translation of a program written in another 
language is likely to result in non-idiomatic Go code and reinforce bad 
habits (bad in the context of Go, not the other language).

I agree it might be painful, and might lead to non-idiomatic Go! But it 
sounds like a really good challenge, and will no doubt teach you a lot 
along the way. It looks like you've already learned something from this 
thread. :-)

Is the app you're converting open source, and if so, can you provide a link 
to the code that leads to the import cycle? With concrete code examples it 
might be easier to advise you how to refactor to avoid the cycle.

One other thing: I've seen a lot of projects in Java (but not just Java: 
C#, JavaScript, even Go) that break things up into very small pieces. One 
5-line class per file, dozens of files and directories for something 
simple, that sort of thing. In Go (I think) it's more common to have larger 
packages.

-Ben

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/da9f27ba-6320-4ec8-b7cb-2e038dfdbda4n%40googlegroups.com.

Reply via email to