从返回元组的func初始化结构

Ok so I have this:

handler.Mount(subRouter, routes.PersonInjection{PeopleById: models.PersonInit()})

PersonInit looks like:

func PersonInit() (Map,Map) {

    peopleById["1"] = Model{ID: 1, Handle: "alex", Firstname: "Alex", Lastname: "Chaz", Email: "alex@example.com", Password:"foo"}
    peopleById["2"] = Model{ID: 2, Handle: "jason",Firstname: "Jason", Lastname: "Statham", Email: "jason@example.com", Password:"foo"}
    peopleByHandle["alex"] = peopleById["1"]
    peopleByHandle["jason"] = peopleById["2"]

    return peopleById, peopleByHandle
}

the Map type is just Map[string]someStruct{}

and PersonInjection{} looks like:

type PersonInjection struct {
    PeopleById, PeopleByHandle person.Map
}

so I am looking to do something like:

handler.Mount(subRouter, routes.PersonInjection{PeopleById,PersonByHandle: models.PersonInit()...})

ummm anyone know how to do something like that?

for now I just have:

    by_id, by_handle := models.PersonInit()
    handler.Mount(subRouter, routes.PersonInjection{PeopleById: by_id, PeopleByHandle:by_handle})

There is no construction in Go which would help to make this one-liner. I think, what you have now is OK, except the underscores in the variable names.

Personally, I would add even more lines for the sake of readability:

var personInj routes.PersonInjection
personInj.PeopleById, personInj.PeopleByHandle = models.PersonInit()
handler.Mount(subRouter, personInj)