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.
Dagger Go SDK 0.4 Highlights:
Dagger now supports pulling container images and executing commands on platforms that differ from the underlying host.
For example, you can use Dagger to compile binaries that target different CPU architectures, test those binaries and push them to a registry bundled as a multi-platform container image, all on a single host.
Improved filesystem API
Import any directory from the host filesystem with
Host.Directory.This replaces the more cumbersome LocalDirs,
Export any directory to the host filesystem with
Directory.Export. This replaces
Export any file to the host filesystem with
Export any container to an OCI archive on the host filesystem with
include:/exclude:params for filtering the set of files to select.
You no longer need to pass IDs, which makes the code you need to write much shorter. See the example below:
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.
Work with the Host Filesystem: This guide explains how to interact with the host filesystem using the Go SDK. It includes code examples of setting the working directory on the host, mounting a host directory in a container, exporting a directory from a container to the host, and more.
Understand Multi-Platform Support: This guide demonstrates different techniques to build applications for multiple platforms using the Go SDK. It includes code examples of building multi-platform applications using emulation and cross-compilation.
Copy Embedded Directories into a Container: This guide explains how to copy an entire directory tree from a host to a container.
Use Dagger with Private Git Repositories: You can use
ssh-addto securely authenticate your Dagger Go CI pipeline against private Git repositories.This guide shows you how.
Are you looking for updates on a different SDK? Fill out this form, and we will notify you when your SDK is ready.