func foo() func() int { }

A function name foo() without parameters/arguments return anonymous function without parameter/arguments return an int type. Empty body

1 func foo()  func() int {
2      return func() int {
3            return 1
4      }
5      
6 }

In the line 2, the return for calling func foo() and follow up with the code of anonmoys function func() with return int type signature. In this body of anonymous func() on line 3 the code return 1.

So when a func foo() called, the body code of func foo() executed instead of just return the results. The results of func foo() pass into anonymous function to be process and then return the results.