func main() { flag.Parse() var client *maps.Client var err error if *apiKey != "" { client, err = maps.NewClient(maps.WithAPIKey(*apiKey)) } else if *clientID != "" || *signature != "" { client, err = maps.NewClient(maps.WithClientIDAndSignature(*clientID, *signature)) } else { usageAndExit("Please specify an API Key, or Client ID and Signature.") } check(err) r := &maps.ElevationRequest{} if *samples > 0 { r.Samples = *samples } if *locations != "" { l, err := decodeLocations(*locations) check(err) r.Locations = l } if *path != "" { p, err := decodePath(*path) check(err) r.Path = p } resp, err := client.Elevation(context.Background(), r) if err != nil { log.Fatalf("Could not request elevations: %v", err) } pretty.Println(resp) }