Hello core engineers,
I have a question regarding: https://github.com/dagger/dagger/blob/417743dd7a085ef6e99faedb4b51b5b0437782bf/cmd/dagger/module.go#L152-L159. I am not sure to understand / fully grasp the way it is evaluated ?
Context
I am having a segfault on a dagger init, inside a subdir where the parent dir has a git context:
506 mkdir dep1
507 cd dep1/
508 git init
509 mkdir foo
510 cd foo/
511 dagger_dev init --name=toto --source=. --sdk=go # segfault
The segfault seems to be coming from a change I introduced which incorrectly makes the foo dir context of kind GIT_SOURCE. However, even if I understand the cause via the change, I'm not sure to grasp / isolate the underlying reason
On my debug logs, it seems that the resolveFromCaller func is being called with the . source dir context at first. As I set the source as . in the dagger init command above, it is expected. Then, I suprisingly see a foo dir context being called afterwards. This only happens when the dep1 parent dir has a git context.
From what I understand, the second resolveFromCaller is segfaulting with the foo dir context, but seems to be called only when we use the export function: https://github.com/dagger/dagger/blob/417743dd7a085ef6e99faedb4b51b5b0437782bf/cmd/dagger/module.go#L159. It does not when commenting
I suspect some sort of lazy evaluation coming into play, however, it is a bit cryptic:
- which API can I use from the moduleSource to force evaluation, to debug ?