On Jun 10, 2022, at 8:47 PM, jlfo...@berkeley.edu
wrote:
>
> One hack solution I came up with to break cycles when Package A depends on
> Package B which depends on Package A is to
> create a symbolic link in Package A to the file(s) in Package B that
> contain(s) the resources needed by Packa
On Friday, June 10, 2022 at 8:47:54 PM UTC-7 jlfo...@berkeley.edu wrote:
>
> One hack solution I came up with to break cycles when Package A depends on
> Package B which depends on Package A is to
> create a symbolic link in Package A to the file(s) in Package B that
> contain(s) the resources
On Friday, June 10, 2022 at 6:48:58 PM UTC-7 ben...@gmail.com wrote:
>
> 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
>
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 o
>
> So, I'll probably have to keep using multiple packages if I can somehow
> figure out how to solve
> the package import cycle problem.
>
The most common solution is to factor out the aspects which cause the cycle
> into a third package that one or both of the current packages imports. In
>
On Thu, Jun 9, 2022 at 7:06 PM jlfo...@berkeley.edu
wrote:
> 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
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
On Thu, Jun 9, 2022 at 5:18 PM jlfo...@berkeley.edu
wrote:
> I'm having trouble understanding what should be a trivial issue.
>
> I have the following file structure:
>
> .
> ├── go.mod
> ├── main.go
> ├── p1
> │ └── p1.go
> └── p2
> └── p2.go
>
> The files are small and simple.
>
> -- go.
I'm having trouble understanding what should be a trivial issue.
I have the following file structure:
.
├── go.mod
├── main.go
├── p1
│ └── p1.go
└── p2
└── p2.go
The files are small and simple.
-- go.mod
module wp
go 1.18
-- main.go
// main.go
package main
import (
"wp/p1"