In some cases, for example, while integrating information retrieval from multiple sources, you only need the first result, the fastest one, and the other results are irrelevant after that. An example from the real world could be extracting the currency rate to count the price. You have multiple third-party services and because you need to show the prices as fast as possible, you need only the first rate received from any service. This recipe will show the pattern for how to achieve such behavior.
Getting the fastest result from multiple sources
How to do it...
- Open the console and create the folder chapter10/recipe06.
- Navigate to the directory.
- Create the file first.go with following content:
package main
...