Merge pull request #664 from harshavardhana/pr_out_trim_iodine_path_properly_so_that_now_errors_have_github_com_minio_minio_prefixed

master
Harshavardhana 10 years ago
commit 792e6c2d3a
  1. 9
      pkg/iodine/iodine.go

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

Loading…
Cancel
Save