[BREAKGLASS] Modern Google Places CLI in Go https://goplaces.sh/
Go to file
Peter Steinberger 9ad292102a docs: add emoji and tagline
📍 Find places, Go fast

🦞
2026-01-02 17:21:52 +01:00
.github/workflows feat: bootstrap goplaces 2026-01-02 17:21:02 +01:00
cmd/goplaces feat: bootstrap goplaces 2026-01-02 17:21:02 +01:00
internal/cli feat: bootstrap goplaces 2026-01-02 17:21:02 +01:00
scripts feat: bootstrap goplaces 2026-01-02 17:21:02 +01:00
.gitignore feat: bootstrap goplaces 2026-01-02 17:21:02 +01:00
.golangci.yml feat: bootstrap goplaces 2026-01-02 17:21:02 +01:00
CHANGELOG.md feat: bootstrap goplaces 2026-01-02 17:21:02 +01:00
client_test.go feat: bootstrap goplaces 2026-01-02 17:21:02 +01:00
client.go feat: bootstrap goplaces 2026-01-02 17:21:02 +01:00
errors_test.go feat: bootstrap goplaces 2026-01-02 17:21:02 +01:00
errors.go feat: bootstrap goplaces 2026-01-02 17:21:02 +01:00
go.mod feat: bootstrap goplaces 2026-01-02 17:21:02 +01:00
go.sum feat: bootstrap goplaces 2026-01-02 17:21:02 +01:00
LICENSE Initial commit 2026-01-02 16:49:23 +01:00
Makefile feat: bootstrap goplaces 2026-01-02 17:21:02 +01:00
README.md docs: add emoji and tagline 2026-01-02 17:21:52 +01:00
types.go feat: bootstrap goplaces 2026-01-02 17:21:02 +01:00

📍 goplaces

Find places, Go fast

Modern Go client + CLI for the Google Places API (New).

Features

  • Text search with filters, location bias, and pagination.
  • Place details by place ID.
  • Resolve a free-form location string into candidates.
  • Human-readable output with color, plus --json for scripts.
  • Strict validation + typed responses.

Install

go get github.com/steipete/goplaces

CLI

Set your API key via env or flag:

export GOOGLE_PLACES_API_KEY="..."

Search:

goplaces search "coffee" --min-rating 4 --open-now --limit 5 \
  --lat 40.8065 --lng -73.9719 --radius-m 3000

Details:

goplaces details ChIJN1t_tDeuEmsRUsoyG83frY4

Resolve:

goplaces resolve "Riverside Park, New York" --limit 5

JSON output:

goplaces search "pizza" --json

CLI reference

goplaces [--api-key=KEY] [--base-url=URL] [--timeout=10s] [--json] [--no-color] [--verbose]
         <command>

Commands:
  search   Search places by text query.
  details  Fetch place details by place ID.
  resolve  Resolve a location string to candidate places.

Library

boolPtr := func(v bool) *bool { return &v }
floatPtr := func(v float64) *float64 { return &v }

client := goplaces.NewClient(goplaces.Options{
    APIKey: os.Getenv("GOOGLE_PLACES_API_KEY"),
})

resp, err := client.Search(ctx, goplaces.SearchRequest{
    Query: "italian restaurant",
    Filters: &goplaces.Filters{
        OpenNow:   boolPtr(true),
        MinRating: floatPtr(4.0),
        Types:     []string{"restaurant"},
    },
    LocationBias: &goplaces.LocationBias{Lat: 40.8065, Lng: -73.9719, RadiusM: 3000},
    Limit: 10,
})

Notes

  • Filters.Types maps to includedType (Google supports a single value). Only the first type is sent.
  • Price levels map to Google enums: 0 (free) → 4 (very expensive).
  • Use GOOGLE_PLACES_BASE_URL to override the endpoint (useful for tests).

Testing

go test ./... -coverprofile=coverage.out

Enforce coverage:

./scripts/check-coverage.sh