Q:

How to return arguments to another function in Go?

I'm trying to create a func that accepts and returns any number of arguments.  I came across anoymous functions:  
  func AWSApiRetry(awsFunc func()) {
        return awsFunc()
    }

This allows me to call a func:
AWSApiRetry(func() {
                    GetEnvState(sess, ApplicationName, EnvName)
                })

but when I try to retrieve the return values from GetEnvState which are (string, err): 
ElbReady, err := AWSApiRetry(func() {
                GetEnvState(sess, ApplicationName, EnvName)
            })

I'm getting the error: AWSApiRetry(func literal) used as value
How can I use my AwsApiretry func to return those types anonymously.  It can be any number and type of return values, so it just sort of 'pass-through' and returns whatever the func being called returns.

A:

You cannot.
AFAIK, in its current form, go is statically typed. What you want to do is create a function/method that returns types not known during compile time. go, by design, does not allow you to create a function/method like that

