Thanks for the quick inciteful response.

> From https://go.dev/ref/spec#Import_declarations:
>
> > It is illegal for a package to import itself, directly or indirectly, 
> or to directly import a package without referring to any of its exported 
> identifiers.
>  
>
I should have researched this. My apologies.
 

> How can this program be made to work? I've tried many things, which all 
>> lead back
>> to the situation I describe above.
>>
>
> You need to refactor the code to eliminate the import cycle. 
> https://jogendra.dev/import-cycles-in-golang-and-how-to-deal-with-them
>

As a learning exercise I'm converting a large app into Go. The app's source 
code
is located in many directories, and I've already learned that all files in 
a package have to be located
in the same directory so that rules out the suggestion in the posting above 
to put everything in
one package. (What's the reason for this requirement)?

So, I'll probably have to keep using multiple packages if I can somehow 
figure out how to solve
the package import cycle problem.

Cordially,
Jon Forrest

 

-- 
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/d5a01fd5-38cd-4dc9-81da-7b6c5aba0890n%40googlegroups.com.

Reply via email to