如何使函数适用于不同的输入类型?

I have this simple generic Request struct to make get requests in my app:

package api

import (
    "net/http"
    "time"
    "log"
    "app/errors"
)

type Request struct {
    Url string
}

func (request *Request) Run(responseObject *AppStatusInfo) *errors.Error {

    req, requestErr := http.NewRequest(http.MethodGet, request.Url, nil)

    req.Header.Set("Content-Type", "application/json")

    timeout := time.Duration(5 * time.Second)

    client := &http.Client{
        Timeout: timeout,
    }

    resp, requestErr := client.Do(req)

    if requestErr != nil {
        return &errors.UnknownError
    }

    decodeError := DecodeJsonRequestBody(resp, &responseObject)

    if (decodeError != nil) {
        return &errors.UnknownError
    }

    defer resp.Body.Close()

    return nil
}

Here responseObject has pointer of type AppStatusInfo which is a struct with some fields.

I run it like this to get app status information and put it inside appStatusInfo object:

var appStatusInfo AppStatusInfo

req := Request{
    Url:config.Config.ApiUrl,
}

req.Run(&appStatusInfo)

So, this code runs fine.

But, when I want to generalize Request to accept other types of responses, like UserProducts, I don't know how to do it without replacing responseObject *AppStatusInfo with responseObject interface{}, then casting it with responseObject.(UserProducts) which I think can be improved.

So, as soon as there are no generics, how do I make Request.Run() accept different types and return respective objects?

Assuming that DecodeJsonRequestBody passes the second argument to json.Unmarshal or json.Decoder.Decode, then write it like this. I show the changed lines only:

func (request *Request) Run(responseObject interface{}) *errors.Error {
   ...
   resp, requestErr := client.Do(req)
   if requestErr != nil {
      return &errors.UnknownError
   }
   defer resp.Body.Close()   // defer close before doing anything else
  ...
  decodeError := DecodeJsonRequestBody(resp, responseObject) // don't take address of responseObject
  ...
}

You can call it like this:

var up UserProducts
err = r.Run(&up)

var asi AppStatusInfo
err = r.Run(&asi)

Type assertions and type conversions are not required.