Back

Build Cloud-native Applications in Go

nitric and golang logos
Ryan CartwrightRyan Cartwright

Ryan Cartwright

2 min read

We recently introduced experimental support for the Go programming language. This is a significant milestone for us, and we are eager to share with you the fantastic capabilities Nitric brings to building cloud-native Go applications.

To assist in getting started we have released full reference documentation and a detailed guide. The step-by-step guide will walk you through setting up a serverless REST API in Go, making it easier than ever to get your Go code running on the cloud. If you prefer a visual learning experience, we have released a video version of our guide:

With the introduction of Nitric for Go, we've made cloud application development more accessible and efficient. Our Go SDK combines straightforward cloud APIs with idiomatic Go syntax, enabling you to create cloud-native applications with ease. To illustrate, here's an example of how you can use Nitric to create an API that writes image data to a bucket:

import (
	"context"
	"fmt"

	"github.com/nitrictech/go-sdk/faas"
	"github.com/nitrictech/go-sdk/nitric"
)

func main() {
	publicApi, err := nitric.NewApi("public")
	if err != nil {
		return
	}

	profiles, err := nitric.NewBucket("profiles").With(nitric.BucketWriting)
	if err != nil {
		return
	}

	publicApi.Get("/hello", func(ctx *faas.HttpContext, _ faas.HttpHandler) (*faas.HttpContext, error) {
		imageData := ctx.Request.Data()

		err := profiles.File("users/bruce-wayne/profile.png").Write(context.TODO(), imageData)

		return ctx, err
	})

	if err := nitric.Run(); err != nil {
		fmt.Println(err)
	}
}

We are excited to see the innovative applications you create using Nitric for Go. Try it out and come chat with us on Discord to let us know what you think.

Stay tuned for more updates and enhancements as we continue to evolve Nitric and the Go SDK.

Previous Post
The Hidden Toll of Infrastructure on Developer Productivity
Next Post
Why we started with Pulumi