goimports_gc.go (484B)
1 // Copyright 2016 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 //go:build gc 6 7 package main 8 9 import ( 10 "flag" 11 "runtime/trace" 12 ) 13 14 var traceProfile = flag.String("trace", "", "trace profile output") 15 16 func doTrace() func() { 17 if *traceProfile != "" { 18 bw, flush := bufferedFileWriter(*traceProfile) 19 trace.Start(bw) 20 return func() { 21 trace.Stop() 22 flush() 23 } 24 } 25 return func() {} 26 }