Skip to content

feat(go-sdk): no longer generate the core bindings#12926

Draft
TomChv wants to merge 3 commits intodagger:mainfrom
TomChv:feat/go-client-using-released-pkg
Draft

feat(go-sdk): no longer generate the core bindings#12926
TomChv wants to merge 3 commits intodagger:mainfrom
TomChv:feat/go-client-using-released-pkg

Conversation

@TomChv
Copy link
Copy Markdown
Member

@TomChv TomChv commented Apr 8, 2026

Summary

  • Replace full core type regeneration with type aliases to dagger.io/dagger in Go module and standalone client codegen
  • Extendable types (Query, Binding, Env) embed their SDK counterparts and only override methods that return other extendable types
  • Pin dagger.io/dagger lib version for client generation in dev mode so schema stays in sync

What changed

Core type aliases: For both modules (internal/dagger/dagger.gen.go) and standalone clients (dagger.gen.go), core API types like Container, Directory, File, etc. are now generated as Go type aliases (type Container = dagger.Container) instead of full struct + method definitions. This preserves type identity — mymodule/internal/dagger.Container IS dagger.io/dagger.Container, enabling third-party library interoperability.

Extendable type wrappers: Query, Binding, and Env can't be simple aliases because dependency modules add methods to them. Instead, they embed the SDK type (dagger.Query) and only generate:

  • WithGraphQLQuery() / With() overrides (to return the wrapper type)
  • Methods whose return type is another extendable type (needed because the embedded method returns the SDK type, not the wrapper)
  • All other methods (e.g., Query.Container(), Query.Directory()) are inherited from the embedded SDK type

WithGraphQLQuery instead of struct literals: In non-library mode, object construction uses new(T).WithGraphQLQuery(q) instead of &T{query: q}, since aliased types have unexported fields.

Client lib version pinning: Standalone client generation now receives the engine's --lib-version flag so that dev engines can resolve dagger.io/dagger at the correct commit.

Signed-off-by: Tom Chauveau tom@dagger.io

@TomChv
Copy link
Copy Markdown
Member Author

TomChv commented Apr 8, 2026

Related to #11547

TomChv added 3 commits April 13, 2026 18:27
Signed-off-by: Tom Chauveau <tom@dagger.io>
Signed-off-by: Tom Chauveau <tom@dagger.io>
@TomChv TomChv force-pushed the feat/go-client-using-released-pkg branch from 18693a4 to 8f3f1a7 Compare April 13, 2026 16:28
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.

1 participant