Skip to content

codegen(go): fix source links in dependency bindings - #14665

Merged
vito merged 2 commits into
dagger:mainfrom
vito:fix-go-dep-source-links
Oct 15, 2026
Merged

vito merged 2 commits into
dagger:mainfrom
vito:fix-go-dep-source-links

Conversation

@vito

@vito vito commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Go module codegen writes dependency bindings to internal/dagger/core/<dep>.gen.go, but ModuleRelPath still added a fixed ../.. prefix, which only fits files in internal/dagger/. So in those files, the source-location comments climbed one directory too few. For example, in .dagger/modules/engine-dev/internal/dagger/core/notify.gen.go:

type Notify struct { // notify (../../../../../.dagger/modules/engine-dev/notify/main.go:18:6)

That path resolves to .dagger/.dagger/modules/..., which doesn't exist.

Git workspaces didn't show the bug. There the engine writes GitHub links, and the go-sdk module's normalize-source-links turns them back into local paths using each file's real depth. So the same go-sdk/generate gave different output from a local checkout and from a git ref, and these lines changed back and forth between regens (see #14662).

This PR builds the prefix from the directory each file is written to. Dependency files in module mode use internal/dagger/core. All other files, and standalone clients, keep the old behavior.

TypeScript isn't affected: its dependency files sit next to client.gen.ts in sdk/src/api/, which matches its fixed ../../../.

Testing

  • Added a unit test for ModuleRelPath.
  • Built an engine from this branch and ran generatedContextDirectory for .dagger/modules/python-client-dev with the repo as a local directory. core/dockerd.gen.go now has the six-../ paths, which match the git-workspace output.

vito added a commit to vito/dagger that referenced this pull request Oct 14, 2026
Record the Go dependency binding source link fix.

Signed-off-by: Alex Suraci <[email protected]>
@grouville
grouville self-requested a review October 14, 2026 00:54
vito added a commit to vito/dagger that referenced this pull request Oct 15, 2026
Record the Go dependency binding source link fix.

Signed-off-by: Alex Suraci <[email protected]>
@vito
vito force-pushed the fix-go-dep-source-links branch from c8024fe to 3da2ab1 Compare October 15, 2026 21:28
vito added 2 commits October 15, 2026 18:09
Dependency bindings moved into internal/dagger/core, but ModuleRelPath
still assumed files were generated into internal/dagger, so their
source-location comments pointed one directory short of the context
root (e.g. .dagger/.dagger/...). Git workspaces did not show it: the
go-sdk module rewrites those comments from the real file depth, so the
generated files changed depending on how the workspace was loaded.

Derive the prefix from the directory each file is generated into.

Signed-off-by: Alex Suraci <[email protected]>
Record the Go dependency binding source link fix.

Signed-off-by: Alex Suraci <[email protected]>
@vito
vito force-pushed the fix-go-dep-source-links branch from 3da2ab1 to 9b3732a Compare October 15, 2026 22:09
@vito
vito merged commit 717589c into dagger:main Oct 15, 2026
94 checks passed
vito added a commit that referenced this pull request Oct 16, 2026
Dependency bindings live in internal/dagger/core/, one directory deeper
than the fixed prefix codegen used before #14665, so their source
comments climbed one directory too few. Match what go-sdk/generate
produces from a git workspace, which the go-sdk/generate/stale check
compares against.

Signed-off-by: Alex Suraci <[email protected]>
eunomie added a commit to eunomie/dagger that referenced this pull request Oct 18, 2026
Cloud generates from a git workspace. A beta.18 run on a local checkout
writes these source links one directory short; dagger#14665
fixes that on main but is not released yet.

Signed-off-by: Yves Brissaud <[email protected]>
eunomie added a commit to eunomie/dagger that referenced this pull request Oct 20, 2026
Cloud generates from a git workspace. A beta.18 run on a local checkout
wrote these source links one directory short; dagger#14665,
released in v1.0.0-beta.19, fixes that, so both modes now agree.

Signed-off-by: Yves Brissaud <[email protected]>
eunomie added a commit to eunomie/dagger that referenced this pull request Oct 21, 2026
Cloud generates from a git workspace. A beta.18 run on a local checkout
wrote these source links one directory short; dagger#14665,
released in v1.0.0-beta.19, fixes that, so both modes now agree.

Signed-off-by: Yves Brissaud <[email protected]>
eunomie added a commit to eunomie/dagger that referenced this pull request Oct 22, 2026
Cloud generates from a git workspace. A beta.18 run on a local checkout
wrote these source links one directory short; dagger#14665,
released in v1.0.0-beta.19, fixes that, so both modes now agree.

Signed-off-by: Yves Brissaud <[email protected]>
eunomie added a commit to eunomie/dagger that referenced this pull request Oct 22, 2026
Cloud generates from a git workspace. A beta.18 run on a local checkout
wrote these source links one directory short; dagger#14665,
released in v1.0.0-beta.19, fixes that, so both modes now agree.

Signed-off-by: Yves Brissaud <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants