Merge pull request #664 from harshavardhana/pr_out_trim_iodine_path_properly_so_that_now_errors_have_github_com_minio_minio_prefixed

This commit is contained in:
Harshavardhana 2015-06-23 13:39:33 -07:00
commit 792e6c2d3a

View File

@ -51,7 +51,7 @@ type StackEntry struct {
Data map[string]string Data map[string]string
} }
var gopath string var gopathSource string
var globalState = struct { var globalState = struct {
sync.RWMutex sync.RWMutex
@ -152,7 +152,7 @@ func createStackEntry() StackEntry {
pc, file, line, _ := runtime.Caller(2) pc, file, line, _ := runtime.Caller(2)
function := runtime.FuncForPC(pc).Name() function := runtime.FuncForPC(pc).Name()
_, function = filepath.Split(function) _, function = filepath.Split(function)
file = strings.TrimPrefix(file, gopath) // trim gopath from file file = strings.TrimPrefix(file, gopathSource) // trim gopathSource from file
data := GetGlobalState() data := GetGlobalState()
for k, v := range getSystemData() { for k, v := range getSystemData() {
@ -190,6 +190,7 @@ func getSystemData() map[string]string {
} }
// Annotate an error with a stack entry and returns itself // Annotate an error with a stack entry and returns itself
//
// func (err *WrappedError) Annotate(info map[string]string) *WrappedError { // func (err *WrappedError) Annotate(info map[string]string) *WrappedError {
// entry := createStackEntry() // entry := createStackEntry()
// for k, v := range info { // for k, v := range info {
@ -224,6 +225,8 @@ func init() {
_, iodineFile, _, _ := runtime.Caller(0) _, iodineFile, _, _ := runtime.Caller(0)
iodineFile = filepath.Dir(iodineFile) // trim iodine.go iodineFile = filepath.Dir(iodineFile) // trim iodine.go
iodineFile = filepath.Dir(iodineFile) // trim iodine iodineFile = filepath.Dir(iodineFile) // trim iodine
iodineFile = filepath.Dir(iodineFile) // trim pkg
iodineFile = filepath.Dir(iodineFile) // trim minio iodineFile = filepath.Dir(iodineFile) // trim minio
gopath = filepath.Dir(iodineFile) + "/" // trim github.com iodineFile = filepath.Dir(iodineFile) // trim minio
gopathSource = filepath.Dir(iodineFile) + "/" // trim github.com
} }