Google Places API (New) · Routes

Places &
routes, in Go.

A typed Go client and a single-binary CLI for finding places, resolving locations, fetching details and photos, autocompleting input, and running route-aware searches.

$ brew install steipete/tap/goplaces
8Commands
1Static binary
--jsonStable output
MITLicense
~/ goplaces zsh
# Find well-rated coffee around Central Park, open right now
$ goplaces search "coffee" --open-now --min-rating 4 \
    --lat 40.8065 --lng -73.9719 --radius-m 3000

Blue Bottle Coffee       4.5  open
Birch Coffee             4.4  open
Daily Provisions         4.6  open
Joe Coffee Company       4.3  closes 6pm

$ goplaces directions --from "Pike Place Market" --to "Space Needle"
Command docs

One page per workflow.

Each command supports human-readable output by default and stable JSON with --json. Global flags — --api-key, --timeout, --no-color, endpoint overrides — work everywhere.

Setup

Install, key, run.

Enable Places API (New). Enable Routes API for route and directions. Then export one API key — the CLI and Go client both pick it up.

Three steps to your first call

  1. 1

    Install the binary.

    Pick Homebrew, go install, or grab a release archive.
  2. 2

    Enable the APIs in Google Cloud.

    Places API (New) is required. Routes API is needed for route and directions.
  3. 3

    Export your key, then run any command.

    export GOOGLE_PLACES_API_KEY="..."
shell
# Install via the steipete tap
$ brew install steipete/tap/goplaces
$ export GOOGLE_PLACES_API_KEY="..."
$ goplaces search "bookstore"
shell
# Direct install via the Go toolchain
$ go install github.com/steipete/goplaces/cmd/goplaces@latest
$ export GOOGLE_PLACES_API_KEY="..."
$ goplaces details ChIJN1t_tDeuEmsRUsoyG83frY4
shell
# Stream the matching archive from the latest GitHub release
$ gh release download --repo steipete/goplaces \
    --pattern "goplaces_*_$(go env GOOS)_$(go env GOARCH).tar.gz" \
    --output - | tar xz
$ ./goplaces --help
Go package

Same workflows, typed.

The root package is github.com/steipete/goplaces. Requests mirror the CLI concepts and own their field masks. No wrapper layer over a giant generated client — small surface, idiomatic types.

What you get

  • ·

    Typed request and response structs

    Place, Photo, Route, Step, OpeningHours — all explicit.
  • ·

    Deterministic field masks

    Each request owns the fields it asks Google for. No surprise costs.
  • ·

    Context everywhere

    Honor cancellation, deadlines, and request-scoped values.
  • ·

    Pluggable HTTP

    Inject your own http.Client for retries, tracing, or fakes.
go
import (
    "context"
    "os"
    "time"

    "github.com/steipete/goplaces"
)

client := goplaces.NewClient(goplaces.Options{
    APIKey:  os.Getenv("GOOGLE_PLACES_API_KEY"),
    Timeout: 8 * time.Second,
})

resp, err := client.Search(ctx, goplaces.SearchRequest{
    Query: "italian restaurant",
    Limit: 10,
    LocationBias: &goplaces.LocationBias{
        Lat: 40.8065, Lng: -73.9719, RadiusM: 3000,
    },
})
Project map

Small surface, clear split.

Two entry points — the CLI and the Go client — share one place and route implementation. Easy to read in an afternoon.

cmd/goplaces

CLI entry

The thin main. Wires up Kong, flags, version info, and exits.

internal/cli

Commands & output

Per-command Kong structs, renderers, and the --json machine output.

github.com/steipete/goplaces

Public client

Typed requests and responses. Owns field masks and retries.

internal/places

HTTP & mapping

The actual Places + Routes calls and the JSON → Go mapping.