Why is the data in pcapBytes incomplete after append? Is it because the data is overwritten or the append fails?
var pcapBytes map[string][][]byte
func initCache(){
pcapBytes := make(map[string][][]byte)
for name,frames in range pcapInfos{
var pcapData [][]byte
var buff bytes.Buffer
buff.Grow(4096)
for _, frame := range frames {
if buff.Len()+frame.Length > 4096 {
pcapData = append(pcapData, buff.Bytes())
buff.Reset()
}
_, err := buff.Write(frame.Data)
if err != nil {
log.Fatal(err)
}
}
if buff.Len() > 0 {
pcapData = append(pcapData, buff.Bytes())
}
pcapBytes[name] = pcapData
}
}