安全吗?
(*TeamData)(unSafe.Poite(&;Team.Id))
示例代码:
func testTrans() []*TeamData {
teams := createTeams()
teamDatas := make([]*TeamData, 0, len(teams))
for _, team := range teams {
// is this safe?
teamDatas = append(teamDatas, (*TeamData)(unSafe.Poite(&;Team.Id)))
}
return teamDatas
}
// ??
teams := testTrans()
teams := testTrans()
数组的成员是否会被垃圾收集?
There are many structs and many fields returned through grpc and their definitions are the same as the local definitions, so I want to use this more efficient way((*TeamData)(unSafe.Poite(&;Team.Id))
), but I don't know if there will be any risks.