SDKs
Go SDK
The official Wayline SDK for Go: Go 1.22+. Standard library only. context.Context on every call.
Install
go get github.com/wayline/wayline-goQuickstart
Set WAYLINE_API_KEY to a test key (see the Quickstart), then:
package main
import (
"context"
"fmt"
"os"
"github.com/wayline/wayline-go"
)
func main() {
client := wayline.NewClient(os.Getenv("WAYLINE_API_KEY"))
d, err := client.Distance(context.Background(), wayline.DistanceRequest{
Origin: wayline.LatLng{Lat: 23.7925, Lng: 90.4078},
Destination: wayline.LatLng{Lat: 23.733, Lng: 90.4172},
Units: wayline.Imperial,
})
if err != nil {
panic(err)
}
fmt.Println(d.DistanceMeters, d.DurationSeconds)
}Errors
Non-2xx responses raise a typed error after retries are exhausted. Branch on code — the full list is in the error reference.
var apiErr *wayline.Error
if errors.As(err, &apiErr) {
fmt.Println(apiErr.Code, apiErr.Status, apiErr.RequestID)
}Configuration
| Option | Default | Description |
|---|---|---|
| API key | WAYLINE_API_KEY | Your live or test key. Never logged. |
| Base URL | https://api.wayline.cloud | Override for staging or a proxy. |
| Timeout | 30 seconds | Per attempt. |
| Max retries | 3 | For 429 and 5xx, with exponential backoff + jitter, honoring Retry-After. |
Source and releases
Package: github.com/wayline/wayline-go on pkg.go.dev. Source: packages/sdk-go. Versions follow semantic versioning; see the CHANGELOG in the package and our product changelog.