# Pagerless for Go

> Standard library only. Init, defer Close, wrap your handler.

URL: https://pagerless.dev/integrations/go
Updated: 2026-10-22

## Set up

```bash
go get github.com/lcbasu/pagerless-go@v0.2.0
```

```go
import (
	"context"
	"net/http"

	pagerless "github.com/lcbasu/pagerless-go"
)

func main() {
	pagerless.Init("") // reads PAGERLESS_KEY; without it every call is a no-op
	defer pagerless.Close(context.Background())

	mux := http.NewServeMux()
	mux.HandleFunc("GET /orders/{id}", getOrder)
	http.ListenAndServe(":8080", pagerless.Middleware(mux))
}
```

## What it catches

- Panics in handlers, reported and re-panicked so your own recovery still runs.
- Status and latency per route, using the Go 1.22+ pattern (`GET /orders/{id}`).
- A heartbeat, and a deploy marker from your VCS build info.
- Errors you report with `pagerless.Capture(err, pagerless.Route("job sync-orders"))`.

## Scheduled jobs

```go
err := pagerless.Monitor(ctx, "nightly-backup", pagerless.Schedule{Cron: "30 3 * * *"}, backup)
```

## Framework adapters

Each is its own module, so the core stays dependency-free: [Gin](https://pagerless.dev/integrations/gin), [Echo](https://pagerless.dev/integrations/echo), [Fiber](https://pagerless.dev/integrations/fiber), [chi and gorilla/mux](https://pagerless.dev/integrations/chi), [gRPC](https://pagerless.dev/integrations/grpc) and [Temporal](https://pagerless.dev/integrations/temporal). Structured logs: `slog.SetDefault(slog.New(pagerless.SlogHandler(slog.NewJSONHandler(os.Stderr, nil))))` reports Error and above.

Go 1.24 or newer. `npx pagerless connect` adds all of this to each `func main` your Dockerfiles run, and wires the adapter for the framework it finds.

## Questions

### Does it use OpenTelemetry?

No. It is standard library only, with no dependencies. If you already export OpenTelemetry, you can also send that: see [OpenTelemetry](https://pagerless.dev/docs/opentelemetry).

### Where is the source?

[pkg.go.dev/github.com/lcbasu/pagerless-go](https://pkg.go.dev/github.com/lcbasu/pagerless-go), MIT licensed.
