尝试使用类型来删除所有这些不必要的分配和类型断言。
type RenameMe struct { Status string `json:"status"` Astatus string `json:"a_status"` Method string `json:"method"` Path string `json:"path"` ElementUid string `json:"element_uid"` TimeLocal time.Time `json:"time_local"` Etime time.Time // deal with this after the fact}data:= &RenameMe{}if err := json.Unmarshal(byt, data); err != nil { break }data.Etime, _ := time.Parse("[02/Jan/2006:15:04:05 -0700]", time_local)我不会对其进行测试以确保其性能优于您的代码,但我敢肯定它会在很大程度上提高性能。试试看,让我知道。



