As you might have seen, we released the Dagger Go SDK 0.3.0 early last week. Thanks to your many questions and suggestions, we were able to ship several additional improvements, which we are releasing today as the Dagger Go SDK 0.4.0.
Note that this version introduces a breaking API change. However, we believe the improved API allows you to write much shorter code, which is significantly better in the long run.
Learn more about Dagger’s multi-platform support
Host.Directory.
This replaces the more cumbersome LocalDirs, Host.Workdir
and HostDirectory.Read
Directory.Export
. This replaces HostDirectory.Write
Directory.Export
Container.Export
.Host.Directory
, Host.Workdir
, and Directory.WithDirectory
now support include:/exclude:
params for filtering the set of files to select.See more examples of working with the host filesystem
You no longer need to pass IDs, which makes the code you need to write much shorter. See the example below:
Before:
modules := c.Directory()
for _, f := range []string{"go.mod", "go.sum", "sdk/go/go.mod", "sdk/go/go.sum"} {
fileID, err := workdir.File(f).ID(ctx)
if err != nil {
return err
}
modules = modules.WithCopiedFile(f, fileID)
}
After:
modules := c.Directory()
for _, f := range []string{"go.mod", "go.sum", "sdk/go/go.mod", "sdk/go/go.sum"} {
modules = modules.WithCopiedFile(f, workdir.File(f))
}
Along with the new release, we’ve added four guides to our documentation that answer the most common questions we’ve heard in the days following the initial release. We hope these guides will help you make the most of the Go SDK.
ssh-add
to securely authenticate your Dagger Go CI pipeline against private Git repositories.This guide shows you how.Thank you to the Dagger Community for your continuous and quick feedback through our Discord channel and GitHub issues. We look forward to releasing more features and documentation soon!
Are you looking for updates on a different SDK? Fill out this form, and we will notify you when your SDK is ready.
Do you have feedback on our documentation? Would you like to suggest a new guide? Send us your feedback and ideas in our Discord channel or open a new issue on GitHub.