Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: dagger/dagger-go-sdk
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.16.2
Choose a base ref
...
head repository: dagger/dagger-go-sdk
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.16.3
Choose a head ref
  • 7 commits
  • 15 files changed
  • 6 contributors

Commits on Feb 27, 2025

  1. feat: add client generation outside module (#9531)

    This PR enables calling module dependencies from a regular client library.
    The setup is quite simple:
    1. Initialize a project in your favorite language
    2. Initialize a dagger module `dagger init`
    3. Install the dagger library
    4. Install any dependencies
    5. Run client generator `dagger client add --generator=<generator>`
    6. Import the generated client and use it like if the library :)
    
    This introduce few changes in an engine:
    - A module can be initialized even if it does not contains sources (only dependency).
    - Client gen has a new flag to specify if the generation is for a standalone client or not.
    - If the client is standalone, it will depends on the published on (I need to add a flag in client generator to handle local changes)
      Note that the setup might still requires few manual operation on the user codebase, like installing the library, execute go mod tidy or configure the tsconfig to override the import path.
    These can be automated.
    - Extends the SDK interface with a new `ClientGenerator` method
      This starts the work to split the SDK interface into smaller component
      The engine could then adapt his behaviour depending on which function the SDK implement (codegen, runtime, modgen etc..)
    - Change dagger run to load a module if one is defined and serving the module with its dependencies.
    
    Signed-off-by: Tom Chauveau <tom@epitech.eu>
    Co-authored-by: Erik Sipsma <erik@sipsma.dev>
    TomChv and sipsma authored Feb 27, 2025

    Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    6721c63 View commit details
  2. shell: filesystem navigation (#9511)

    * cli: trivial cleanups
    
    Signed-off-by: Helder Correia <174525+helderco@users.noreply.github.com>
    
    * poc: navigate a local module's context directory
    
    Signed-off-by: Helder Correia <174525+helderco@users.noreply.github.com>
    
    * add proper support for git sources
    
    Signed-off-by: Helder Correia <174525+helderco@users.noreply.github.com>
    
    * prefer the API over configuredModule
    
    Signed-off-by: Helder Correia <174525+helderco@users.noreply.github.com>
    
    * rebase on top of Erik's PR
    
    Signed-off-by: Helder Correia <174525+helderco@users.noreply.github.com>
    
    * simplify module loading
    
    Signed-off-by: Helder Correia <174525+helderco@users.noreply.github.com>
    
    * add ModuleSource.originalSubpath field to API
    
    Signed-off-by: Helder Correia <174525+helderco@users.noreply.github.com>
    
    * delegate more to the API
    
    Signed-off-by: Helder Correia <174525+helderco@users.noreply.github.com>
    
    * several fixes and cleanups
    
    Signed-off-by: Helder Correia <174525+helderco@users.noreply.github.com>
    
    * when `--no-mod` is used, root to git repo if exists
    
    Signed-off-by: Helder Correia <174525+helderco@users.noreply.github.com>
    
    * hide call to LocalContextDirectoryPath
    
    Signed-off-by: Helder Correia <174525+helderco@users.noreply.github.com>
    
    * shell:  exclude builtin commands from autocomplete
    
    Signed-off-by: Helder Correia <174525+helderco@users.noreply.github.com>
    
    * support current module's name as a way to call constructor
    
    Signed-off-by: Helder Correia <174525+helderco@users.noreply.github.com>
    
    * shell: expose echo and wait interpreter builtins
    
    Signed-off-by: Helder Correia <174525+helderco@users.noreply.github.com>
    
    * shell: add .types builtin and support .help <type>
    
    Signed-off-by: Helder Correia <174525+helderco@users.noreply.github.com>
    
    * remove workdir path from prompt
    
    Signed-off-by: Helder Correia <174525+helderco@users.noreply.github.com>
    
    * appease linter
    
    Signed-off-by: Alex Suraci <alex@dagger.io>
    
    * fix test assertions
    
    Signed-off-by: Alex Suraci <alex@dagger.io>
    
    * completion: keep stdlib, skip builtins, update tests
    
    Signed-off-by: Alex Suraci <alex@dagger.io>
    
    * cmd/dagger tests: properly suite-ify
    
    Signed-off-by: Alex Suraci <alex@dagger.io>
    
    ---------
    
    Signed-off-by: Helder Correia <174525+helderco@users.noreply.github.com>
    Signed-off-by: Alex Suraci <alex@dagger.io>
    Co-authored-by: Alex Suraci <alex@dagger.io>
    helderco and vito authored Feb 27, 2025

    Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    9017a6f View commit details

Commits on Mar 4, 2025

  1. chore(deps): bump github.com/vektah/gqlparser/v2 (#9760)

    Bumps the engine group with 1 update in the /sdk/go directory: [github.com/vektah/gqlparser/v2](https://github.com/vektah/gqlparser).
    
    
    Updates `github.com/vektah/gqlparser/v2` from 2.5.22 to 2.5.23
    - [Release notes](https://github.com/vektah/gqlparser/releases)
    - [Commits](vektah/gqlparser@v2.5.22...v2.5.23)
    
    ---
    updated-dependencies:
    - dependency-name: github.com/vektah/gqlparser/v2
      dependency-type: direct:production
      update-type: version-update:semver-patch
      dependency-group: engine
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Mar 4, 2025
    Copy the full SHA
    c845a25 View commit details

Commits on Mar 6, 2025

  1. feat: add persistency for generated clients (#9758)

    Update `generateClient` to only set fields in the
    configuration so now the generation
    logic happens in `generatedContextDirectory`.
    That way, it works with `dagger develop`.
    
    Also add persistency in `dagger.json` for generated clients.
    
    Correctly use contextDirectory in codegen instead
    of only the source directory.
    
    Signed-off-by: Tom Chauveau <tom@epitech.eu>
    TomChv authored Mar 6, 2025
    Copy the full SHA
    3b47063 View commit details

Commits on Mar 10, 2025

  1. chore(deps): bump the engine group across 2 directories with 13 updat…

    …es (#9821)
    
    Bumps the engine group with 9 updates in the / directory:
    
    | Package | From | To |
    | --- | --- | --- |
    | [github.com/1password/onepassword-sdk-go](https://github.com/1password/onepassword-sdk-go) | `0.1.7` | `0.2.0` |
    | [github.com/opencontainers/image-spec](https://github.com/opencontainers/image-spec) | `1.1.0` | `1.1.1` |
    | [golang.org/x/crypto](https://github.com/golang/crypto) | `0.35.0` | `0.36.0` |
    | [golang.org/x/mod](https://github.com/golang/mod) | `0.23.0` | `0.24.0` |
    | [golang.org/x/net](https://github.com/golang/net) | `0.35.0` | `0.37.0` |
    | [golang.org/x/oauth2](https://github.com/golang/oauth2) | `0.27.0` | `0.28.0` |
    | [golang.org/x/tools](https://github.com/golang/tools) | `0.30.0` | `0.31.0` |
    | [google.golang.org/grpc](https://github.com/grpc/grpc-go) | `1.70.0` | `1.71.0` |
    | [mvdan.cc/sh/v3](https://github.com/mvdan/sh) | `3.10.1-0.20250103084315-5e4be7920b8b` | `3.11.0` |
    
    Bumps the engine group with 2 updates in the /sdk/go directory: [golang.org/x/net](https://github.com/golang/net) and [google.golang.org/grpc](https://github.com/grpc/grpc-go).
    
    Updates `github.com/1password/onepassword-sdk-go` from 0.1.7 to 0.2.0
    - [Release notes](https://github.com/1password/onepassword-sdk-go/releases)
    - [Commits](1Password/onepassword-sdk-go@v0.1.7...v0.2.0)
    
    Updates `github.com/opencontainers/image-spec` from 1.1.0 to 1.1.1
    - [Release notes](https://github.com/opencontainers/image-spec/releases)
    - [Changelog](https://github.com/opencontainers/image-spec/blob/main/RELEASES.md)
    - [Commits](opencontainers/image-spec@v1.1.0...v1.1.1)
    
    Updates `golang.org/x/crypto` from 0.35.0 to 0.36.0
    - [Commits](golang/crypto@v0.35.0...v0.36.0)
    
    Updates `golang.org/x/mod` from 0.23.0 to 0.24.0
    - [Commits](golang/mod@v0.23.0...v0.24.0)
    
    Updates `golang.org/x/net` from 0.35.0 to 0.37.0
    - [Commits](golang/net@v0.35.0...v0.37.0)
    
    Updates `golang.org/x/oauth2` from 0.27.0 to 0.28.0
    - [Commits](golang/oauth2@v0.27.0...v0.28.0)
    
    Updates `golang.org/x/sync` from 0.11.0 to 0.12.0
    - [Commits](golang/sync@v0.11.0...v0.12.0)
    
    Updates `golang.org/x/sys` from 0.30.0 to 0.31.0
    - [Commits](golang/sys@v0.30.0...v0.31.0)
    
    Updates `golang.org/x/term` from 0.29.0 to 0.30.0
    - [Commits](golang/term@v0.29.0...v0.30.0)
    
    Updates `golang.org/x/text` from 0.22.0 to 0.23.0
    - [Release notes](https://github.com/golang/text/releases)
    - [Commits](golang/text@v0.22.0...v0.23.0)
    
    Updates `golang.org/x/tools` from 0.30.0 to 0.31.0
    - [Release notes](https://github.com/golang/tools/releases)
    - [Commits](golang/tools@v0.30.0...v0.31.0)
    
    Updates `google.golang.org/grpc` from 1.70.0 to 1.71.0
    - [Release notes](https://github.com/grpc/grpc-go/releases)
    - [Commits](grpc/grpc-go@v1.70.0...v1.71.0)
    
    Updates `mvdan.cc/sh/v3` from 3.10.1-0.20250103084315-5e4be7920b8b to 3.11.0
    - [Release notes](https://github.com/mvdan/sh/releases)
    - [Changelog](https://github.com/mvdan/sh/blob/master/CHANGELOG.md)
    - [Commits](https://github.com/mvdan/sh/commits/v3.11.0)
    
    Updates `golang.org/x/net` from 0.35.0 to 0.37.0
    - [Commits](golang/net@v0.35.0...v0.37.0)
    
    Updates `golang.org/x/sync` from 0.11.0 to 0.12.0
    - [Commits](golang/sync@v0.11.0...v0.12.0)
    
    Updates `golang.org/x/sys` from 0.30.0 to 0.31.0
    - [Commits](golang/sys@v0.30.0...v0.31.0)
    
    Updates `golang.org/x/text` from 0.22.0 to 0.23.0
    - [Release notes](https://github.com/golang/text/releases)
    - [Commits](golang/text@v0.22.0...v0.23.0)
    
    Updates `google.golang.org/grpc` from 1.70.0 to 1.71.0
    - [Release notes](https://github.com/grpc/grpc-go/releases)
    - [Commits](grpc/grpc-go@v1.70.0...v1.71.0)
    
    ---
    updated-dependencies:
    - dependency-name: github.com/1password/onepassword-sdk-go
      dependency-type: direct:production
      update-type: version-update:semver-minor
      dependency-group: engine
    - dependency-name: github.com/opencontainers/image-spec
      dependency-type: direct:production
      update-type: version-update:semver-patch
      dependency-group: engine
    - dependency-name: golang.org/x/crypto
      dependency-type: direct:production
      update-type: version-update:semver-minor
      dependency-group: engine
    - dependency-name: golang.org/x/mod
      dependency-type: direct:production
      update-type: version-update:semver-minor
      dependency-group: engine
    - dependency-name: golang.org/x/net
      dependency-type: direct:production
      update-type: version-update:semver-minor
      dependency-group: engine
    - dependency-name: golang.org/x/oauth2
      dependency-type: direct:production
      update-type: version-update:semver-minor
      dependency-group: engine
    - dependency-name: golang.org/x/sync
      dependency-type: direct:production
      update-type: version-update:semver-minor
      dependency-group: engine
    - dependency-name: golang.org/x/sys
      dependency-type: direct:production
      update-type: version-update:semver-minor
      dependency-group: engine
    - dependency-name: golang.org/x/term
      dependency-type: direct:production
      update-type: version-update:semver-minor
      dependency-group: engine
    - dependency-name: golang.org/x/text
      dependency-type: direct:production
      update-type: version-update:semver-minor
      dependency-group: engine
    - dependency-name: golang.org/x/tools
      dependency-type: direct:production
      update-type: version-update:semver-minor
      dependency-group: engine
    - dependency-name: google.golang.org/grpc
      dependency-type: direct:production
      update-type: version-update:semver-minor
      dependency-group: engine
    - dependency-name: mvdan.cc/sh/v3
      dependency-type: direct:production
      update-type: version-update:semver-minor
      dependency-group: engine
    - dependency-name: golang.org/x/net
      dependency-type: indirect
      update-type: version-update:semver-minor
      dependency-group: engine
    - dependency-name: golang.org/x/sync
      dependency-type: direct:production
      update-type: version-update:semver-minor
      dependency-group: engine
    - dependency-name: golang.org/x/sys
      dependency-type: indirect
      update-type: version-update:semver-minor
      dependency-group: engine
    - dependency-name: golang.org/x/text
      dependency-type: indirect
      update-type: version-update:semver-minor
      dependency-group: engine
    - dependency-name: google.golang.org/grpc
      dependency-type: direct:production
      update-type: version-update:semver-minor
      dependency-group: engine
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Mar 10, 2025
    Copy the full SHA
    bca449d View commit details
  2. feat: add Directory.asGit (#9730)

    * chore: move matchVersion helpers to modulesource.go
    
    These are exclusively used in modulesource.go, so we should move them to
    there.
    
    Signed-off-by: Justin Chadwell <me@jedevc.com>
    
    * tests: refactor GitTest to avoid testutil.Query
    
    Signed-off-by: Justin Chadwell <me@jedevc.com>
    
    * feat: add Directory.asGit
    
    Signed-off-by: Justin Chadwell <me@jedevc.com>
    
    * feat: refactor dagop usage
    
    This allows returning `File`s and `Directory`s more easily, using a
    wrapped immutable cache ref - this avoids needing our nasty hack to
    import from the host file system: we can just write directly to our
    cache ref.
    
    To get this working with `Container.asTarball` though, we needed a
    little reworking, so that's it's possible to get a reasonable filename
    for the tarball. Potentially this doesn't work if the filename is
    *completely* unknown until running the function? So, the
    `DirectoryDagOp` becomes a generic `FSDagOp` able to handle both
    `Directory`s and `File`s.
    
    Signed-off-by: Justin Chadwell <me@jedevc.com>
    
    * chore: suggestions from review
    
    Signed-off-by: Justin Chadwell <me@jedevc.com>
    
    * add support for result release callbacks, use on dir/file
    
    Signed-off-by: Erik Sipsma <erik@sipsma.dev>
    
    * fix sdk call cache hits on repos w/ different auth
    
    Signed-off-by: Erik Sipsma <erik@sipsma.dev>
    
    * fix: extractLLBDependencies with nil data
    
    Signed-off-by: Justin Chadwell <me@jedevc.com>
    
    ---------
    
    Signed-off-by: Justin Chadwell <me@jedevc.com>
    Signed-off-by: Erik Sipsma <erik@sipsma.dev>
    Co-authored-by: Erik Sipsma <erik@sipsma.dev>
    jedevc and sipsma authored Mar 10, 2025

    Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    9a36b6b View commit details

Commits on Mar 12, 2025

  1. chore: prep for v0.16.3 (#9849)

    * chore: bump dependencies to v0.16.3
    
    Signed-off-by: Justin Chadwell <me@jedevc.com>
    
    * chore: add release notes for v0.16.3
    
    Signed-off-by: Justin Chadwell <me@jedevc.com>
    
    * chore: bump .changes/.next to v0.16.4
    
    Signed-off-by: Justin Chadwell <me@jedevc.com>
    
    ---------
    
    Signed-off-by: Justin Chadwell <me@jedevc.com>
    jedevc authored Mar 12, 2025
    Copy the full SHA
    1d065b0 View commit details
13 changes: 13 additions & 0 deletions .changes/v0.16.3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## sdk/go/v0.16.3 - 2025-03-12

This SDK uses 🚙 Engine + 🚗 CLI version `v0.16.3`. [See what changed in that release](https://github.com/dagger/dagger/releases/tag/v0.16.3).

🐹 https://pkg.go.dev/dagger.io/dagger@v0.16.3

### Dependencies
- Bump Engine to v0.16.3 by @jedevc in https://github.com/dagger/dagger/pull/9849

### What to do next
- Read the [documentation](https://docs.dagger.io/sdk/go)
- Join our [Discord server](https://discord.gg/dagger-io)
- Follow us on [Twitter](https://twitter.com/dagger_io)
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -6,6 +6,20 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [Changie](https://github.com/miniscruff/changie).

## sdk/go/v0.16.3 - 2025-03-12

This SDK uses 🚙 Engine + 🚗 CLI version `v0.16.3`. [See what changed in that release](https://github.com/dagger/dagger/releases/tag/v0.16.3).

🐹 https://pkg.go.dev/dagger.io/dagger@v0.16.3

### Dependencies
- Bump Engine to v0.16.3 by @jedevc in https://github.com/dagger/dagger/pull/9849

### What to do next
- Read the [documentation](https://docs.dagger.io/sdk/go)
- Join our [Discord server](https://discord.gg/dagger-io)
- Follow us on [Twitter](https://twitter.com/dagger_io)

## sdk/go/v0.16.2 - 2025-02-27

This SDK uses 🚙 Engine + 🚗 CLI version `v0.16.2`. [See what changed in that release](https://github.com/dagger/dagger/releases/tag/v0.16.2).
12 changes: 11 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ import (
"github.com/Khan/genqlient/graphql"
"github.com/vektah/gqlparser/v2/gqlerror"

"dagger.io/dagger/internal/engineconn"
"dagger.io/dagger/engineconn"
"dagger.io/dagger/querybuilder"
)

@@ -81,6 +81,12 @@ func WithRunnerHost(runnerHost string) ClientOpt {
})
}

func WithServeCurrentModule(serveCurrentModule bool) ClientOpt {
return clientOptFunc(func(cfg *engineconn.Config) {
cfg.ServeCurrentModule = serveCurrentModule
})
}

// Connect to a Dagger Engine
func Connect(ctx context.Context, opts ...ClientOpt) (*Client, error) {
cfg := &engineconn.Config{}
@@ -108,6 +114,10 @@ func (c *Client) GraphQLClient() graphql.Client {
return c.client
}

func (c *Client) QueryBuilder() *querybuilder.Selection {
return c.query
}

// Close the engine connection
func (c *Client) Close() error {
if c.conn != nil {
12 changes: 11 additions & 1 deletion dag/dag.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

190 changes: 188 additions & 2 deletions dagger.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
13 changes: 7 additions & 6 deletions internal/engineconn/engineconn.go → engineconn/engineconn.go
Original file line number Diff line number Diff line change
@@ -21,12 +21,13 @@ type EngineConn interface {
}

type Config struct {
Workdir string
LogOutput io.Writer
RunnerHost string
Conn EngineConn
VersionOverride string
Verbosity int
Workdir string
LogOutput io.Writer
RunnerHost string
Conn EngineConn
VersionOverride string
Verbosity int
ServeCurrentModule bool
}

type ConnectParams struct {
File renamed without changes.
4 changes: 4 additions & 0 deletions internal/engineconn/session.go → engineconn/session.go
Original file line number Diff line number Diff line change
@@ -94,6 +94,10 @@ func startCLISession(ctx context.Context, binPath string, cfg *Config) (_ Engine
args = append(args, "-"+strings.Repeat("v", cfg.Verbosity))
}

if cfg.ServeCurrentModule {
args = append(args, "--serve-module")
}

env := os.Environ()

if cfg.RunnerHost != "" {
5 changes: 5 additions & 0 deletions engineconn/version.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions fs.go
Original file line number Diff line number Diff line change
@@ -12,6 +12,9 @@ var QueryBuilder embed.FS
//go:embed telemetry/*.go
var Telemetry embed.FS

//go:embed engineconn/*.go
var EngineConn embed.FS

//go:embed go.mod
var GoMod []byte

Loading