At Transloadit, we are huge fans of the Go programming language. Not only due to its simplicity, but also its ability to power efficient systems. In fact, one of our core components, which is responsible for managing the clusters of machines on AWS, is written using Go. And so is tusd, the reference server implementation for tus - our open protocol for resumable file uploads. That's why we were excited when we first released the official Transloadit Go SDK back in 2014.

However, with the SDK nearing its third birthday, we decided to sit down and give it a facelift. And here we are today, proud to share the result with you by announcing the 1.0 release of the Go SDK! Version 1.0 features a fully revised API interface, full documentation and support for Go's context package. The latter is useful for defining request timeouts in order to prevent hang-ups.

Let's jump straight into code and let me guide you through a brief example:

1. Firstly, make sure that you have Go 1.7 or higher installed. If not, please download it. Afterwards, we can install the package by simply running the following command:

go get -u gopkg.in/transloadit/go-sdk.v1

That's all you need to do to install it. In order to complete the remaining steps, we can move directly to the code.

2. Secondly, we create a new Client instance by extending the default configuration with your API credentials:

options := transloadit.DefaultConfig
options.AuthKey = "AUTH_KEY"
options.AuthSecret = "AUTH_SECRET"
client := transloadit.NewClient(options)

3. Next, we create the Assembly struct, add a file to upload and define the instructions for how to process it:

assembly := transloadit.NewAssembly()
assembly.AddFile("image", "./path/to/your/file")
assembly.AddStep("resize", map[string]interface{}{
  "robot":           "/image/resize",
  "width":           75,
  "height":          75,
  "resize_strategy": "pad",
  "background":      "#000000",
})

4. After specifying our instructions, it is time to transmit them to Transloadit and start executing the necessary operations:

info, err := client.StartAssembly(context.Background(), assembly)

5. Finally, we should wait until execution has finished and our results are available:

info, err = client.WaitForAssembly(context.Background(), info)
fmt.Printf("You can view the result at: %s\n", info.Results["resize"][0].SSLURL)

And that's it! You have just successfully executed your first assembly using our new Go SDK! If you'd like to know even more, please have a look at these additional resources:

P.S. We are currently dedicating more of our efforts into improving our SDKs to bring you the best possible experience. So, stay tuned for future announcements like this one!