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.
# 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"
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.
search
Find places by text, type, rating, price, open state, and location bias.
nearby
Search around a required latitude, longitude, and radius.
autocomplete
Return place and query suggestions from partial input.
details
Address, coordinates, phone, website, hours, photos, reviews, status.
photo
Turn a Places photo resource name into a media URL.
resolve
Convert free-form location text into candidate place IDs.
route
Sample a route and search for places near waypoints.
directions
Distance, duration, warnings, steps, units, drive modifiers.
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
Install the binary.
Pick Homebrew,go install, or grab a release archive. - 2
Enable the APIs in Google Cloud.
Places API (New) is required. Routes API is needed forrouteanddirections. - 3
Export your key, then run any command.
export GOOGLE_PLACES_API_KEY="..."
# Install via the steipete tap $ brew install steipete/tap/goplaces $ export GOOGLE_PLACES_API_KEY="..." $ goplaces search "bookstore"
# Direct install via the Go toolchain $ go install github.com/steipete/goplaces/cmd/goplaces@latest $ export GOOGLE_PLACES_API_KEY="..." $ goplaces details ChIJN1t_tDeuEmsRUsoyG83frY4
# 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
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 ownhttp.Clientfor retries, tracing, or fakes.
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, }, })
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.
CLI entry
The thin main. Wires up Kong, flags, version info, and exits.
Commands & output
Per-command Kong structs, renderers, and the --json machine output.
Public client
Typed requests and responses. Owns field masks and retries.
HTTP & mapping
The actual Places + Routes calls and the JSON → Go mapping.