1
0
mirror of https://github.com/google/gops.git synced 2024-11-24 08:22:25 +02:00

rename exit to exitIfError

This commit is contained in:
Jaana Burcu Dogan 2016-11-04 00:55:16 -07:00
parent b73016d838
commit c4c8158bfa

17
gops.go
View File

@ -57,21 +57,21 @@ func main() {
}
if *stack {
out, err := cmd(signal.Stack)
exit(err)
exitIfError(err)
fmt.Println(out)
}
if *gc {
_, err := cmd(signal.GC)
exit(err)
exitIfError(err)
}
if *memstats {
out, err := cmd(signal.MemStats)
exit(err)
exitIfError(err)
fmt.Printf(out)
}
if *version {
out, err := cmd(signal.Version)
exit(err)
exitIfError(err)
fmt.Printf(out)
}
}
@ -145,9 +145,10 @@ func usage() {
os.Exit(1)
}
func exit(err error) {
if err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
os.Exit(1)
func exitIfError(err error) {
if err == nil {
return
}
fmt.Fprintf(os.Stderr, "%v\n", err)
os.Exit(1)
}