-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/goimports: work around lack of runtime/trace in gccgo
Moves runtime/trace support (including its command line flag) behind a "gc" build tag to allow goimports to build under gccgo, which does not support runtime/trace. Updates golang/go#15544. Change-Id: I017a44089c0a4f3d3ba98815d57a141e25b3fe56 Reviewed-on: https://go-review.googlesource.com/26998 Run-TryBot: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]>
- Loading branch information
Showing
3 changed files
with
41 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright 2016 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
// +build gc | ||
|
||
package main | ||
|
||
import ( | ||
"flag" | ||
"runtime/trace" | ||
) | ||
|
||
var traceProfile = flag.String("trace", "", "trace profile output") | ||
|
||
func doTrace() func() { | ||
if *traceProfile != "" { | ||
bw, flush := bufferedFileWriter(*traceProfile) | ||
trace.Start(bw) | ||
return func() { | ||
flush() | ||
trace.Stop() | ||
} | ||
} | ||
return func() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright 2016 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
// +build !gc | ||
|
||
package main | ||
|
||
func doTrace() func() { | ||
return func() {} | ||
} |