Ah, excellent. Good catch. I learned something about defer.
The ordering of the close was my problem, however.
The way I *actually* handle closing the trace is:
func (t *FileTracer) Stop() error {
if t == nil {
return nil
}
trace.Stop()
return t.f.Close()
}
On Friday, August 4, 2017 at 12:42:31
On Friday, 4 August 2017 15:46:39 UTC+10, Evan Leis wrote:
>
> I ran into this same problem, and found this post!
> It looks like you're making the same simple mistake I was:
>
> # erroneous:
> defer f.Close()
> defer trace.Stop()
>
Defers run in LIFO order. This sample will call trace.Stop, the
I ran into this same problem, and found this post!
It looks like you're making the same simple mistake I was:
# erroneous:
defer f.Close()
defer trace.Stop()
You must stop the trace *before* closing the output file.
# corrected:
defer func() {
trace.Stop()
panic(f.Close()) # Be sure to handl
On Tuesday, October 11, 2016 at 7:21:17 AM UTC-7, xavier zebier wrote:
>
> C:\repo\gonew\src\github.com\tixu\trace>go tool trace Trace
> 2016-10-11T153554.out
> 2016/10/11 15:36:45 Parsing trace...
> failed to parse trace: no EvFrequency event
>
> Can you help me .?
>
> Thanks in advance,
>
> X