Go Builder (@now/go)

Status: Alpha

This builder takes in a Go program that defines a singular HTTP handler and outputs it as a Lambda.

Whenever you want to expose an API or a function written in Go.

Define a index.go file inside a folder as follows:

package main

import (

func Handler(w http.ResponseWriter, r *http.Request) {
        fmt.Fprintf(w, "<h1>Hello from Go on Now!</h1>")

And define a now.json like:

  "version": 2,
  "builds": [{ "src": "*.go", "use": "@now/go" }]

Notice that the API is cohesive with the net/http Go API. Your main entrypoint function must be called Handler.

The example above can be seen live from the following URL: https://go-deployment-l78bij0fj.now.sh/

The entrypoint file must be a .go source file with a Handler function inside implementing the net/http API.

Go 1.x is used.

To help keep cold boot times low, the maximum output bundle size for a Go lambda is, by default, 10mb.

This limit is extendable up to 50mb.

Example maxLambdaSize configuration:
  "builds": [
    { "src": "*.go", "use": "@now/go", "config": { "maxLambdaSize": "20mb" } }