{"action":"created","comment":{"url":"https://api.github.com/repos/yarpc/yarpc-go/pulls/comments/92884434","pull_request_review_id":13409247,"id":92884434,"diff_hunk":"@@ -0,0 +1,46 @@\n+package sync\n+\n+import (\n+\t\"errors\"\n+\t\"testing\"\n+\n+\t\"github.com/stretchr/testify/assert\"\n+\t\"github.com/uber-go/atomic\"\n+)\n+\n+func TestOnce(t *testing.T) {\n+\tonce := Once{}\n+\tonceCalls := atomic.NewInt32(0)\n+\texpectedErr := errors.New(\"test error\")\n+\n+\twait := ErrorWaiter{}\n+\tfor i := 0; i < 10; i++ {\n+\t\twait.Submit(func() error {\n+\t\t\treturn once.Do(func() error {\n+\t\t\t\tonceCalls.Inc()\n+\t\t\t\treturn expectedErr\n+\t\t\t})\n+\t\t})\n+\t}\n+\terrs := wait.Wait()\n+\n+\tassert.Equal(t, 1, int(onceCalls.Load()), \"number of executions of once was not 1\")\n+\tfor _, err := range errs {\n+\t\tassert.Equal(t, expectedErr, err)\n+\t}\n+\tassert.True(t, once.Done())\n+}\n+\n+func TestOnceNotFinished(t *testing.T) {\n+\tonce := Once{}\n+\n+\tassert.False(t, once.Done())\n+}\n+\n+func TestOnceSetDone(t *testing.T) {\n+\tonce := Once{}","path":"internal/sync/once_test.go","position":41,"original_position":41,"commit_id":"7a03ffdb4bde40531d32b3be1d1201f6a8e56a5e","original_commit_id":"7a03ffdb4bde40531d32b3be1d1201f6a8e56a5e","user":{"login":"abhinav","id":41730,"avatar_url":"https://avatars.githubusercontent.com/u/41730?v=3","gravatar_id":"","url":"https://api.github.com/users/abhinav","html_url":"https://github.com/abhinav","followers_url":"https://api.github.com/users/abhinav/followers","following_url":"https://api.github.com/users/abhinav/following{/other_user}","gists_url":"https://api.github.com/users/abhinav/gists{/gist_id}","starred_url":"https://api.github.com/users/abhinav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abhinav/subscriptions","organizations_url":"https://api.github.com/users/abhinav/orgs","repos_url":"https://api.github.com/users/abhinav/repos","events_url":"https://api.github.com/users/abhinav/events{/privacy}","received_events_url":"https://api.github.com/users/abhinav/received_events","type":"User","site_admin":false},"body":"var","created_at":"2016-12-16T20:55:27Z","updated_at":"2016-12-16T20:55:31Z","html_url":"https://github.com/yarpc/yarpc-go/pull/603#discussion_r92884434","pull_request_url":"https://api.github.com/repos/yarpc/yarpc-go/pulls/603","_links":{"self":{"href":"https://api.github.com/repos/yarpc/yarpc-go/pulls/comments/92884434"},"html":{"href":"https://github.com/yarpc/yarpc-go/pull/603#discussion_r92884434"},"pull_request":{"href":"https://api.github.com/repos/yarpc/yarpc-go/pulls/603"}}},"pull_request":{"url":"https://api.github.com/repos/yarpc/yarpc-go/pulls/603","id":98399261,"html_url":"https://github.com/yarpc/yarpc-go/pull/603","diff_url":"https://github.com/yarpc/yarpc-go/pull/603.diff","patch_url":"https://github.com/yarpc/yarpc-go/pull/603.patch","issue_url":"https://api.github.com/repos/yarpc/yarpc-go/issues/603","number":603,"state":"open","locked":false,"title":"lifecycle: 3.5: Add sync.Once and sync.LifecycleOnce","user":{"login":"willhug","id":613317,"avatar_url":"https://avatars.githubusercontent.com/u/613317?v=3","gravatar_id":"","url":"https://api.github.com/users/willhug","html_url":"https://github.com/willhug","followers_url":"https://api.github.com/users/willhug/followers","following_url":"https://api.github.com/users/willhug/following{/other_user}","gists_url":"https://api.github.com/users/willhug/gists{/gist_id}","starred_url":"https://api.github.com/users/willhug/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/willhug/subscriptions","organizations_url":"https://api.github.com/users/willhug/orgs","repos_url":"https://api.github.com/users/willhug/repos","events_url":"https://api.github.com/users/willhug/events{/privacy}","received_events_url":"https://api.github.com/users/willhug/received_events","type":"User","site_admin":false},"body":"Summary: This diff adds a custom sync.Once and sync.LifecycleOnce.  These\nare convenience structs for adding idempotent start/stop functions for\nlifecycle objects.","created_at":"2016-12-16T20:37:35Z","updated_at":"2016-12-16T20:55:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3e0196217783e9e1f23c7a8dd69769068a4ef6a0","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/yarpc/yarpc-go/pulls/603/commits","review_comments_url":"https://api.github.com/repos/yarpc/yarpc-go/pulls/603/comments","review_comment_url":"https://api.github.com/repos/yarpc/yarpc-go/pulls/comments{/number}","comments_url":"https://api.github.com/repos/yarpc/yarpc-go/issues/603/comments","statuses_url":"https://api.github.com/repos/yarpc/yarpc-go/statuses/7a03ffdb4bde40531d32b3be1d1201f6a8e56a5e","head":{"label":"yarpc:startstop-part_3.5","ref":"startstop-part_3.5","sha":"7a03ffdb4bde40531d32b3be1d1201f6a8e56a5e","user":{"login":"yarpc","id":16569504,"avatar_url":"https://avatars.githubusercontent.com/u/16569504?v=3","gravatar_id":"","url":"https://api.github.com/users/yarpc","html_url":"https://github.com/yarpc","followers_url":"https://api.github.com/users/yarpc/followers","following_url":"https://api.github.com/users/yarpc/following{/other_user}","gists_url":"https://api.github.com/users/yarpc/gists{/gist_id}","starred_url":"https://api.github.com/users/yarpc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yarpc/subscriptions","organizations_url":"https://api.github.com/users/yarpc/orgs","repos_url":"https://api.github.com/users/yarpc/repos","events_url":"https://api.github.com/users/yarpc/events{/privacy}","received_events_url":"https://api.github.com/users/yarpc/received_events","type":"Organization","site_admin":false},"repo":{"id":50390111,"name":"yarpc-go","full_name":"yarpc/yarpc-go","owner":{"login":"yarpc","id":16569504,"avatar_url":"https://avatars.githubusercontent.com/u/16569504?v=3","gravatar_id":"","url":"https://api.github.com/users/yarpc","html_url":"https://github.com/yarpc","followers_url":"https://api.github.com/users/yarpc/followers","following_url":"https://api.github.com/users/yarpc/following{/other_user}","gists_url":"https://api.github.com/users/yarpc/gists{/gist_id}","starred_url":"https://api.github.com/users/yarpc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yarpc/subscriptions","organizations_url":"https://api.github.com/users/yarpc/orgs","repos_url":"https://api.github.com/users/yarpc/repos","events_url":"https://api.github.com/users/yarpc/events{/privacy}","received_events_url":"https://api.github.com/users/yarpc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yarpc/yarpc-go","description":"YARPC for Golang","fork":false,"url":"https://api.github.com/repos/yarpc/yarpc-go","forks_url":"https://api.github.com/repos/yarpc/yarpc-go/forks","keys_url":"https://api.github.com/repos/yarpc/yarpc-go/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yarpc/yarpc-go/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yarpc/yarpc-go/teams","hooks_url":"https://api.github.com/repos/yarpc/yarpc-go/hooks","issue_events_url":"https://api.github.com/repos/yarpc/yarpc-go/issues/events{/number}","events_url":"https://api.github.com/repos/yarpc/yarpc-go/events","assignees_url":"https://api.github.com/repos/yarpc/yarpc-go/assignees{/user}","branches_url":"https://api.github.com/repos/yarpc/yarpc-go/branches{/branch}","tags_url":"https://api.github.com/repos/yarpc/yarpc-go/tags","blobs_url":"https://api.github.com/repos/yarpc/yarpc-go/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yarpc/yarpc-go/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yarpc/yarpc-go/git/refs{/sha}","trees_url":"https://api.github.com/repos/yarpc/yarpc-go/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yarpc/yarpc-go/statuses/{sha}","languages_url":"https://api.github.com/repos/yarpc/yarpc-go/languages","stargazers_url":"https://api.github.com/repos/yarpc/yarpc-go/stargazers","contributors_url":"https://api.github.com/repos/yarpc/yarpc-go/contributors","subscribers_url":"https://api.github.com/repos/yarpc/yarpc-go/subscribers","subscription_url":"https://api.github.com/repos/yarpc/yarpc-go/subscription","commits_url":"https://api.github.com/repos/yarpc/yarpc-go/commits{/sha}","git_commits_url":"https://api.github.com/repos/yarpc/yarpc-go/git/commits{/sha}","comments_url":"https://api.github.com/repos/yarpc/yarpc-go/comments{/number}","issue_comment_url":"https://api.github.com/repos/yarpc/yarpc-go/issues/comments{/number}","contents_url":"https://api.github.com/repos/yarpc/yarpc-go/contents/{+path}","compare_url":"https://api.github.com/repos/yarpc/yarpc-go/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yarpc/yarpc-go/merges","archive_url":"https://api.github.com/repos/yarpc/yarpc-go/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yarpc/yarpc-go/downloads","issues_url":"https://api.github.com/repos/yarpc/yarpc-go/issues{/number}","pulls_url":"https://api.github.com/repos/yarpc/yarpc-go/pulls{/number}","milestones_url":"https://api.github.com/repos/yarpc/yarpc-go/milestones{/number}","notifications_url":"https://api.github.com/repos/yarpc/yarpc-go/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yarpc/yarpc-go/labels{/name}","releases_url":"https://api.github.com/repos/yarpc/yarpc-go/releases{/id}","deployments_url":"https://api.github.com/repos/yarpc/yarpc-go/deployments","created_at":"2016-01-26T00:04:14Z","updated_at":"2016-12-05T00:47:16Z","pushed_at":"2016-12-16T20:46:11Z","git_url":"git://github.com/yarpc/yarpc-go.git","ssh_url":"git@github.com:yarpc/yarpc-go.git","clone_url":"https://github.com/yarpc/yarpc-go.git","svn_url":"https://github.com/yarpc/yarpc-go","homepage":"","size":5015,"stargazers_count":11,"watchers_count":11,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":56,"forks":3,"open_issues":56,"watchers":11,"default_branch":"dev"}},"base":{"label":"yarpc:_start_-startstop-part_3.5","ref":"_start_-startstop-part_3.5","sha":"d974fa2a33d95d3fd09c8a32417695db9b01816e","user":{"login":"yarpc","id":16569504,"avatar_url":"https://avatars.githubusercontent.com/u/16569504?v=3","gravatar_id":"","url":"https://api.github.com/users/yarpc","html_url":"https://github.com/yarpc","followers_url":"https://api.github.com/users/yarpc/followers","following_url":"https://api.github.com/users/yarpc/following{/other_user}","gists_url":"https://api.github.com/users/yarpc/gists{/gist_id}","starred_url":"https://api.github.com/users/yarpc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yarpc/subscriptions","organizations_url":"https://api.github.com/users/yarpc/orgs","repos_url":"https://api.github.com/users/yarpc/repos","events_url":"https://api.github.com/users/yarpc/events{/privacy}","received_events_url":"https://api.github.com/users/yarpc/received_events","type":"Organization","site_admin":false},"repo":{"id":50390111,"name":"yarpc-go","full_name":"yarpc/yarpc-go","owner":{"login":"yarpc","id":16569504,"avatar_url":"https://avatars.githubusercontent.com/u/16569504?v=3","gravatar_id":"","url":"https://api.github.com/users/yarpc","html_url":"https://github.com/yarpc","followers_url":"https://api.github.com/users/yarpc/followers","following_url":"https://api.github.com/users/yarpc/following{/other_user}","gists_url":"https://api.github.com/users/yarpc/gists{/gist_id}","starred_url":"https://api.github.com/users/yarpc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yarpc/subscriptions","organizations_url":"https://api.github.com/users/yarpc/orgs","repos_url":"https://api.github.com/users/yarpc/repos","events_url":"https://api.github.com/users/yarpc/events{/privacy}","received_events_url":"https://api.github.com/users/yarpc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yarpc/yarpc-go","description":"YARPC for Golang","fork":false,"url":"https://api.github.com/repos/yarpc/yarpc-go","forks_url":"https://api.github.com/repos/yarpc/yarpc-go/forks","keys_url":"https://api.github.com/repos/yarpc/yarpc-go/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yarpc/yarpc-go/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yarpc/yarpc-go/teams","hooks_url":"https://api.github.com/repos/yarpc/yarpc-go/hooks","issue_events_url":"https://api.github.com/repos/yarpc/yarpc-go/issues/events{/number}","events_url":"https://api.github.com/repos/yarpc/yarpc-go/events","assignees_url":"https://api.github.com/repos/yarpc/yarpc-go/assignees{/user}","branches_url":"https://api.github.com/repos/yarpc/yarpc-go/branches{/branch}","tags_url":"https://api.github.com/repos/yarpc/yarpc-go/tags","blobs_url":"https://api.github.com/repos/yarpc/yarpc-go/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yarpc/yarpc-go/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yarpc/yarpc-go/git/refs{/sha}","trees_url":"https://api.github.com/repos/yarpc/yarpc-go/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yarpc/yarpc-go/statuses/{sha}","languages_url":"https://api.github.com/repos/yarpc/yarpc-go/languages","stargazers_url":"https://api.github.com/repos/yarpc/yarpc-go/stargazers","contributors_url":"https://api.github.com/repos/yarpc/yarpc-go/contributors","subscribers_url":"https://api.github.com/repos/yarpc/yarpc-go/subscribers","subscription_url":"https://api.github.com/repos/yarpc/yarpc-go/subscription","commits_url":"https://api.github.com/repos/yarpc/yarpc-go/commits{/sha}","git_commits_url":"https://api.github.com/repos/yarpc/yarpc-go/git/commits{/sha}","comments_url":"https://api.github.com/repos/yarpc/yarpc-go/comments{/number}","issue_comment_url":"https://api.github.com/repos/yarpc/yarpc-go/issues/comments{/number}","contents_url":"https://api.github.com/repos/yarpc/yarpc-go/contents/{+path}","compare_url":"https://api.github.com/repos/yarpc/yarpc-go/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yarpc/yarpc-go/merges","archive_url":"https://api.github.com/repos/yarpc/yarpc-go/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yarpc/yarpc-go/downloads","issues_url":"https://api.github.com/repos/yarpc/yarpc-go/issues{/number}","pulls_url":"https://api.github.com/repos/yarpc/yarpc-go/pulls{/number}","milestones_url":"https://api.github.com/repos/yarpc/yarpc-go/milestones{/number}","notifications_url":"https://api.github.com/repos/yarpc/yarpc-go/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yarpc/yarpc-go/labels{/name}","releases_url":"https://api.github.com/repos/yarpc/yarpc-go/releases{/id}","deployments_url":"https://api.github.com/repos/yarpc/yarpc-go/deployments","created_at":"2016-01-26T00:04:14Z","updated_at":"2016-12-05T00:47:16Z","pushed_at":"2016-12-16T20:46:11Z","git_url":"git://github.com/yarpc/yarpc-go.git","ssh_url":"git@github.com:yarpc/yarpc-go.git","clone_url":"https://github.com/yarpc/yarpc-go.git","svn_url":"https://github.com/yarpc/yarpc-go","homepage":"","size":5015,"stargazers_count":11,"watchers_count":11,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":56,"forks":3,"open_issues":56,"watchers":11,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/yarpc/yarpc-go/pulls/603"},"html":{"href":"https://github.com/yarpc/yarpc-go/pull/603"},"issue":{"href":"https://api.github.com/repos/yarpc/yarpc-go/issues/603"},"comments":{"href":"https://api.github.com/repos/yarpc/yarpc-go/issues/603/comments"},"review_comments":{"href":"https://api.github.com/repos/yarpc/yarpc-go/pulls/603/comments"},"review_comment":{"href":"https://api.github.com/repos/yarpc/yarpc-go/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/yarpc/yarpc-go/pulls/603/commits"},"statuses":{"href":"https://api.github.com/repos/yarpc/yarpc-go/statuses/7a03ffdb4bde40531d32b3be1d1201f6a8e56a5e"}}}}
{"actor":{"display_login":"abhinav"}}