I'm using async await via babel-plugin-transform-async-to-generator.
At the top-level I'm awaiting a function response. Then there another two async functions func1 and func2. func2 asynchronously retrieves the content of https://www.google.com.
The following script returns:
go() called
func1() called
finished
func2() called
func2() called
func2() called
How can I only console.log('finished') after all call are executed successfully? Is it possible without returning them explicitly as Promises using resolve/reject?
This example is greatly simplified. What I'm trying to do involves recursive function calls I'd to await as well
const rp = require('request-promise')
go()
async function go() {
  console.log("go() called")
  await func1([1,2,3])
  console.log("finished the script")
}
async function func1(arr) {
  console.log("func1() called")
  arr.forEach(async function(element) {
    await func2()
  })
}
async function func2() {
  var res = await rp('https://www.google.com')
  console.log("func2() called")
}
