From ef63e9af55fcfe3255dddec3197bd8a807152c66 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Fri, 18 Mar 2016 19:37:29 +0100 Subject: Godeps: add github.com/rjeczalik/notify --- .../src/github.com/rjeczalik/notify/debug_debug.go | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Godeps/_workspace/src/github.com/rjeczalik/notify/debug_debug.go (limited to 'Godeps/_workspace/src/github.com/rjeczalik/notify/debug_debug.go') diff --git a/Godeps/_workspace/src/github.com/rjeczalik/notify/debug_debug.go b/Godeps/_workspace/src/github.com/rjeczalik/notify/debug_debug.go new file mode 100644 index 000000000..f0622917f --- /dev/null +++ b/Godeps/_workspace/src/github.com/rjeczalik/notify/debug_debug.go @@ -0,0 +1,43 @@ +// Copyright (c) 2014-2015 The Notify Authors. All rights reserved. +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. + +// +build debug + +package notify + +import ( + "fmt" + "os" + "runtime" + "strings" +) + +func dbgprint(v ...interface{}) { + fmt.Printf("[D] ") + fmt.Print(v...) + fmt.Printf("\n\n") +} + +func dbgprintf(format string, v ...interface{}) { + fmt.Printf("[D] ") + fmt.Printf(format, v...) + fmt.Printf("\n\n") +} + +func dbgcallstack(max int) []string { + pc, stack := make([]uintptr, max), make([]string, 0, max) + runtime.Callers(2, pc) + for _, pc := range pc { + if f := runtime.FuncForPC(pc); f != nil { + fname := f.Name() + idx := strings.LastIndex(fname, string(os.PathSeparator)) + if idx != -1 { + stack = append(stack, fname[idx+1:]) + } else { + stack = append(stack, fname) + } + } + } + return stack +} -- cgit