//Unmarshal restore an execution instance from the format.Exception message. func (x *execution) Unmarshal(f *format.Execution) error { b, err := hex.DecodeString(f.GetVersion()) if err != nil { return err } if len(b) != 20 { return fmt.Errorf("invalid sha1 length %d instead of 20", len(b)) } copy(x.version[:], b) x.start = time.Unix(f.GetStart(), 0) x.end = time.Unix(f.GetEnd(), 0) x.errcode = int(f.GetErrcode()) x.result = bytes.NewBufferString(f.GetResult()) return nil }