I'm new to Go and I want to call a function repeatedly and asynchronously after a specific time interval just like how the setInterval()
function works in JavaScript. I want to build an API which returns some news headlines from different websites but scraping the websites on every request would be very slow. So, I want to call the web scraping function asynchronously in the background after every 10 minutes to update the headline data.
// I want to call this function every 10 minutes
func WebScraper(data map[string]interface{}) {
// Web scraping stuff
}
How can I do this?