{"action":"opened","number":7,"pull_request":{"url":"https://api.github.com/repos/uniplaces/go-logger/pulls/7","id":218717986,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE4NzE3OTg2","html_url":"https://github.com/uniplaces/go-logger/pull/7","diff_url":"https://github.com/uniplaces/go-logger/pull/7.diff","patch_url":"https://github.com/uniplaces/go-logger/pull/7.patch","issue_url":"https://api.github.com/repos/uniplaces/go-logger/issues/7","number":7,"state":"open","locked":false,"title":"[RFC][UN-14538] Fix unexpected stack trace of error","user":{"login":"sardyy","id":12813036,"node_id":"MDQ6VXNlcjEyODEzMDM2","avatar_url":"https://avatars0.githubusercontent.com/u/12813036?v=4","gravatar_id":"","url":"https://api.github.com/users/sardyy","html_url":"https://github.com/sardyy","followers_url":"https://api.github.com/users/sardyy/followers","following_url":"https://api.github.com/users/sardyy/following{/other_user}","gists_url":"https://api.github.com/users/sardyy/gists{/gist_id}","starred_url":"https://api.github.com/users/sardyy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sardyy/subscriptions","organizations_url":"https://api.github.com/users/sardyy/orgs","repos_url":"https://api.github.com/users/sardyy/repos","events_url":"https://api.github.com/users/sardyy/events{/privacy}","received_events_url":"https://api.github.com/users/sardyy/received_events","type":"User","site_admin":false},"body":"After playing a bit with ```pkg/errors``` and its methods, I realized that the stack trace of the error outputed was not the expected.\r\n\r\nImagine the following scenario:\r\n\r\n```go\r\nfile x:\r\nline 1 -> error1 := errors.New(\"error 1\")\r\n\r\nfile y:\r\nline 1 -> error2 := errors.Wrap(error1, \"error 2\")\r\n\r\nfile z:\r\nline 1 -> error3 := errors.WithMessage(error2, \"error 3\")\r\nline 2 -> Builder().Error(error3)\r\n```\r\n\r\nWith the current implementation, if we pass the ```error3``` to our logger, since it isn't a stack tracer, it falls into the default case, which calls the ```buildStackTrace()``` and prints the stack trace beginning in the function caller of ```error3``` (file y, line 2) and this is not the expected.\r\n\r\nThe expected  behaviour is a stack trace beginning in file x, line 1, because we are using the method ```Wrap``` that sets a stack trace point. If we change the ```Wrap``` to ```WithMessage``` the stack trace should begin in file x, line 1.\r\n\r\nThis PR aims to solve this problem by using the ```first stackTracer error``` in the error chain if exists. If not, fallbacks to the default.\r\n\r\n","created_at":"2018-09-27T16:39:01Z","updated_at":"2018-09-27T16:39:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/uniplaces/go-logger/pulls/7/commits","review_comments_url":"https://api.github.com/repos/uniplaces/go-logger/pulls/7/comments","review_comment_url":"https://api.github.com/repos/uniplaces/go-logger/pulls/comments{/number}","comments_url":"https://api.github.com/repos/uniplaces/go-logger/issues/7/comments","statuses_url":"https://api.github.com/repos/uniplaces/go-logger/statuses/b535bff3d450ed837bef380dcb7dfaa7f806d8a9","head":{"label":"uniplaces:UN-14538/unexpected-stack-trace-according-to-pkg-errors","ref":"UN-14538/unexpected-stack-trace-according-to-pkg-errors","sha":"b535bff3d450ed837bef380dcb7dfaa7f806d8a9","user":{"login":"uniplaces","id":1397679,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzOTc2Nzk=","avatar_url":"https://avatars1.githubusercontent.com/u/1397679?v=4","gravatar_id":"","url":"https://api.github.com/users/uniplaces","html_url":"https://github.com/uniplaces","followers_url":"https://api.github.com/users/uniplaces/followers","following_url":"https://api.github.com/users/uniplaces/following{/other_user}","gists_url":"https://api.github.com/users/uniplaces/gists{/gist_id}","starred_url":"https://api.github.com/users/uniplaces/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uniplaces/subscriptions","organizations_url":"https://api.github.com/users/uniplaces/orgs","repos_url":"https://api.github.com/users/uniplaces/repos","events_url":"https://api.github.com/users/uniplaces/events{/privacy}","received_events_url":"https://api.github.com/users/uniplaces/received_events","type":"Organization","site_admin":false},"repo":{"id":93530486,"node_id":"MDEwOlJlcG9zaXRvcnk5MzUzMDQ4Ng==","name":"go-logger","full_name":"uniplaces/go-logger","private":false,"owner":{"login":"uniplaces","id":1397679,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzOTc2Nzk=","avatar_url":"https://avatars1.githubusercontent.com/u/1397679?v=4","gravatar_id":"","url":"https://api.github.com/users/uniplaces","html_url":"https://github.com/uniplaces","followers_url":"https://api.github.com/users/uniplaces/followers","following_url":"https://api.github.com/users/uniplaces/following{/other_user}","gists_url":"https://api.github.com/users/uniplaces/gists{/gist_id}","starred_url":"https://api.github.com/users/uniplaces/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uniplaces/subscriptions","organizations_url":"https://api.github.com/users/uniplaces/orgs","repos_url":"https://api.github.com/users/uniplaces/repos","events_url":"https://api.github.com/users/uniplaces/events{/privacy}","received_events_url":"https://api.github.com/users/uniplaces/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/uniplaces/go-logger","description":null,"fork":false,"url":"https://api.github.com/repos/uniplaces/go-logger","forks_url":"https://api.github.com/repos/uniplaces/go-logger/forks","keys_url":"https://api.github.com/repos/uniplaces/go-logger/keys{/key_id}","collaborators_url":"https://api.github.com/repos/uniplaces/go-logger/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/uniplaces/go-logger/teams","hooks_url":"https://api.github.com/repos/uniplaces/go-logger/hooks","issue_events_url":"https://api.github.com/repos/uniplaces/go-logger/issues/events{/number}","events_url":"https://api.github.com/repos/uniplaces/go-logger/events","assignees_url":"https://api.github.com/repos/uniplaces/go-logger/assignees{/user}","branches_url":"https://api.github.com/repos/uniplaces/go-logger/branches{/branch}","tags_url":"https://api.github.com/repos/uniplaces/go-logger/tags","blobs_url":"https://api.github.com/repos/uniplaces/go-logger/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/uniplaces/go-logger/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/uniplaces/go-logger/git/refs{/sha}","trees_url":"https://api.github.com/repos/uniplaces/go-logger/git/trees{/sha}","statuses_url":"https://api.github.com/repos/uniplaces/go-logger/statuses/{sha}","languages_url":"https://api.github.com/repos/uniplaces/go-logger/languages","stargazers_url":"https://api.github.com/repos/uniplaces/go-logger/stargazers","contributors_url":"https://api.github.com/repos/uniplaces/go-logger/contributors","subscribers_url":"https://api.github.com/repos/uniplaces/go-logger/subscribers","subscription_url":"https://api.github.com/repos/uniplaces/go-logger/subscription","commits_url":"https://api.github.com/repos/uniplaces/go-logger/commits{/sha}","git_commits_url":"https://api.github.com/repos/uniplaces/go-logger/git/commits{/sha}","comments_url":"https://api.github.com/repos/uniplaces/go-logger/comments{/number}","issue_comment_url":"https://api.github.com/repos/uniplaces/go-logger/issues/comments{/number}","contents_url":"https://api.github.com/repos/uniplaces/go-logger/contents/{+path}","compare_url":"https://api.github.com/repos/uniplaces/go-logger/compare/{base}...{head}","merges_url":"https://api.github.com/repos/uniplaces/go-logger/merges","archive_url":"https://api.github.com/repos/uniplaces/go-logger/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/uniplaces/go-logger/downloads","issues_url":"https://api.github.com/repos/uniplaces/go-logger/issues{/number}","pulls_url":"https://api.github.com/repos/uniplaces/go-logger/pulls{/number}","milestones_url":"https://api.github.com/repos/uniplaces/go-logger/milestones{/number}","notifications_url":"https://api.github.com/repos/uniplaces/go-logger/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/uniplaces/go-logger/labels{/name}","releases_url":"https://api.github.com/repos/uniplaces/go-logger/releases{/id}","deployments_url":"https://api.github.com/repos/uniplaces/go-logger/deployments","created_at":"2017-06-06T14:54:39Z","updated_at":"2018-03-23T11:04:32Z","pushed_at":"2018-09-27T16:16:22Z","git_url":"git://github.com/uniplaces/go-logger.git","ssh_url":"git@github.com:uniplaces/go-logger.git","clone_url":"https://github.com/uniplaces/go-logger.git","svn_url":"https://github.com/uniplaces/go-logger","homepage":null,"size":636,"stargazers_count":2,"watchers_count":2,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":1,"open_issues":1,"watchers":2,"default_branch":"master"}},"base":{"label":"uniplaces:master","ref":"master","sha":"bd836cb53735ba3b9b07b7c3a14c396798937e99","user":{"login":"uniplaces","id":1397679,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzOTc2Nzk=","avatar_url":"https://avatars1.githubusercontent.com/u/1397679?v=4","gravatar_id":"","url":"https://api.github.com/users/uniplaces","html_url":"https://github.com/uniplaces","followers_url":"https://api.github.com/users/uniplaces/followers","following_url":"https://api.github.com/users/uniplaces/following{/other_user}","gists_url":"https://api.github.com/users/uniplaces/gists{/gist_id}","starred_url":"https://api.github.com/users/uniplaces/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uniplaces/subscriptions","organizations_url":"https://api.github.com/users/uniplaces/orgs","repos_url":"https://api.github.com/users/uniplaces/repos","events_url":"https://api.github.com/users/uniplaces/events{/privacy}","received_events_url":"https://api.github.com/users/uniplaces/received_events","type":"Organization","site_admin":false},"repo":{"id":93530486,"node_id":"MDEwOlJlcG9zaXRvcnk5MzUzMDQ4Ng==","name":"go-logger","full_name":"uniplaces/go-logger","private":false,"owner":{"login":"uniplaces","id":1397679,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzOTc2Nzk=","avatar_url":"https://avatars1.githubusercontent.com/u/1397679?v=4","gravatar_id":"","url":"https://api.github.com/users/uniplaces","html_url":"https://github.com/uniplaces","followers_url":"https://api.github.com/users/uniplaces/followers","following_url":"https://api.github.com/users/uniplaces/following{/other_user}","gists_url":"https://api.github.com/users/uniplaces/gists{/gist_id}","starred_url":"https://api.github.com/users/uniplaces/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uniplaces/subscriptions","organizations_url":"https://api.github.com/users/uniplaces/orgs","repos_url":"https://api.github.com/users/uniplaces/repos","events_url":"https://api.github.com/users/uniplaces/events{/privacy}","received_events_url":"https://api.github.com/users/uniplaces/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/uniplaces/go-logger","description":null,"fork":false,"url":"https://api.github.com/repos/uniplaces/go-logger","forks_url":"https://api.github.com/repos/uniplaces/go-logger/forks","keys_url":"https://api.github.com/repos/uniplaces/go-logger/keys{/key_id}","collaborators_url":"https://api.github.com/repos/uniplaces/go-logger/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/uniplaces/go-logger/teams","hooks_url":"https://api.github.com/repos/uniplaces/go-logger/hooks","issue_events_url":"https://api.github.com/repos/uniplaces/go-logger/issues/events{/number}","events_url":"https://api.github.com/repos/uniplaces/go-logger/events","assignees_url":"https://api.github.com/repos/uniplaces/go-logger/assignees{/user}","branches_url":"https://api.github.com/repos/uniplaces/go-logger/branches{/branch}","tags_url":"https://api.github.com/repos/uniplaces/go-logger/tags","blobs_url":"https://api.github.com/repos/uniplaces/go-logger/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/uniplaces/go-logger/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/uniplaces/go-logger/git/refs{/sha}","trees_url":"https://api.github.com/repos/uniplaces/go-logger/git/trees{/sha}","statuses_url":"https://api.github.com/repos/uniplaces/go-logger/statuses/{sha}","languages_url":"https://api.github.com/repos/uniplaces/go-logger/languages","stargazers_url":"https://api.github.com/repos/uniplaces/go-logger/stargazers","contributors_url":"https://api.github.com/repos/uniplaces/go-logger/contributors","subscribers_url":"https://api.github.com/repos/uniplaces/go-logger/subscribers","subscription_url":"https://api.github.com/repos/uniplaces/go-logger/subscription","commits_url":"https://api.github.com/repos/uniplaces/go-logger/commits{/sha}","git_commits_url":"https://api.github.com/repos/uniplaces/go-logger/git/commits{/sha}","comments_url":"https://api.github.com/repos/uniplaces/go-logger/comments{/number}","issue_comment_url":"https://api.github.com/repos/uniplaces/go-logger/issues/comments{/number}","contents_url":"https://api.github.com/repos/uniplaces/go-logger/contents/{+path}","compare_url":"https://api.github.com/repos/uniplaces/go-logger/compare/{base}...{head}","merges_url":"https://api.github.com/repos/uniplaces/go-logger/merges","archive_url":"https://api.github.com/repos/uniplaces/go-logger/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/uniplaces/go-logger/downloads","issues_url":"https://api.github.com/repos/uniplaces/go-logger/issues{/number}","pulls_url":"https://api.github.com/repos/uniplaces/go-logger/pulls{/number}","milestones_url":"https://api.github.com/repos/uniplaces/go-logger/milestones{/number}","notifications_url":"https://api.github.com/repos/uniplaces/go-logger/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/uniplaces/go-logger/labels{/name}","releases_url":"https://api.github.com/repos/uniplaces/go-logger/releases{/id}","deployments_url":"https://api.github.com/repos/uniplaces/go-logger/deployments","created_at":"2017-06-06T14:54:39Z","updated_at":"2018-03-23T11:04:32Z","pushed_at":"2018-09-27T16:16:22Z","git_url":"git://github.com/uniplaces/go-logger.git","ssh_url":"git@github.com:uniplaces/go-logger.git","clone_url":"https://github.com/uniplaces/go-logger.git","svn_url":"https://github.com/uniplaces/go-logger","homepage":null,"size":636,"stargazers_count":2,"watchers_count":2,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":1,"open_issues":1,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/uniplaces/go-logger/pulls/7"},"html":{"href":"https://github.com/uniplaces/go-logger/pull/7"},"issue":{"href":"https://api.github.com/repos/uniplaces/go-logger/issues/7"},"comments":{"href":"https://api.github.com/repos/uniplaces/go-logger/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/uniplaces/go-logger/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/uniplaces/go-logger/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/uniplaces/go-logger/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/uniplaces/go-logger/statuses/b535bff3d450ed837bef380dcb7dfaa7f806d8a9"}},"author_association":"NONE","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":false,"commits":1,"additions":36,"deletions":2,"changed_files":2}}
{"actor":{"display_login":"sardyy"}}