Skip to content

Commit a1ec4f4

Browse files
authored
Merge branch 'master' into context
2 parents 11ef91c + 82629e0 commit a1ec4f4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+1593
-774
lines changed

AUTHORS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
# Authors who wish to be recognized in this file should add themselves (or
99
# their employer, as appropriate).
1010

11+
Abhinav Gupta <mail@abhinavg.net>
1112
Ainsley Chong <ainsley.chong@gmail.com>
1213
Akeda Bagus <akeda@x-team.com>
1314
Alec Thomas <alec@swapoff.org>
@@ -106,6 +107,7 @@ Rob Figueiredo <robfig@yext.com>
106107
Ronak Jain <ronakjain@outlook.in>
107108
Ruben Vereecken <rubenvereecken@gmail.com>
108109
Ryan Lower <rpjlower@gmail.com>
110+
Sahil Dua <sahildua2305@gmail.com>
109111
saisi <saisi@users.noreply.github.com>
110112
Sander van Harmelen <svanharmelen@schubergphilis.com>
111113
Sean Wang <sean@decrypted.org>
@@ -117,6 +119,7 @@ Thomas Bruyelle <thomas.bruyelle@gmail.com>
117119
Timothée Peignier <timothee.peignier@tryphon.org>
118120
Trey Tacon <ttacon@gmail.com>
119121
ttacon <ttacon@gmail.com>
122+
Varadarajan Aravamudhan <varadaraajan@gmail.com>
120123
Victor Castell <victor@victorcastell.com>
121124
Victor Vrantchan <vrancean+github@gmail.com>
122125
Will Maier <wcmaier@gmail.com>

CONTRIBUTING.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# How to contribute #
22

3-
We'd love to accept your patches and contributions to this project. There are
3+
We'd love to accept your patches and contributions to this project. There are
44
a just a few small guidelines you need to follow.
55

66

77
## Contributor License Agreement ##
88

99
Contributions to any Google project must be accompanied by a Contributor
10-
License Agreement. This is not a copyright **assignment**, it simply gives
10+
License Agreement. This is not a copyright **assignment**, it simply gives
1111
Google permission to use and redistribute your contributions as part of the
12-
project. Head over to <https://cla.developers.google.com/> to see your current
12+
project. Head over to <https://cla.developers.google.com/> to see your current
1313
agreements on file or to sign a new one.
1414

1515
You generally only need to submit a CLA once, so if you've already submitted one
@@ -20,25 +20,25 @@ again.
2020
## Submitting a patch ##
2121

2222
1. It's generally best to start by opening a new issue describing the bug or
23-
feature you're intending to fix. Even if you think it's relatively minor,
24-
it's helpful to know what people are working on. Mention in the initial
23+
feature you're intending to fix. Even if you think it's relatively minor,
24+
it's helpful to know what people are working on. Mention in the initial
2525
issue that you are planning to work on that bug or feature so that it can
2626
be assigned to you.
2727

2828
1. Follow the normal process of [forking][] the project, and setup a new
29-
branch to work in. It's important that each group of changes be done in
29+
branch to work in. It's important that each group of changes be done in
3030
separate branches in order to ensure that a pull request only includes the
3131
commits related to that bug or feature.
3232

3333
1. Go makes it very simple to ensure properly formatted code, so always run
34-
`go fmt` on your code before committing it. You should also run
35-
[golint][] over your code. As noted in the [golint readme][], it's not
34+
`go fmt` on your code before committing it. You should also run
35+
[golint][] over your code. As noted in the [golint readme][], it's not
3636
strictly necessary that your code be completely "lint-free", but this will
3737
help you find common style issues.
3838

39-
1. Any significant changes should almost always be accompanied by tests. The
39+
1. Any significant changes should almost always be accompanied by tests. The
4040
project already has good test coverage, so look at some of the existing
41-
tests if you're unsure how to go about it. [gocov][] and [gocov-html][]
41+
tests if you're unsure how to go about it. [gocov][] and [gocov-html][]
4242
are invaluable tools for seeing which parts of your code aren't being
4343
exercised by your tests.
4444

@@ -61,16 +61,16 @@ again.
6161
## Other notes on code organization ##
6262

6363
Currently, everything is defined in the main `github` package, with API methods
64-
broken into separate service objects. These services map directly to how
64+
broken into separate service objects. These services map directly to how
6565
the [GitHub API documentation][] is organized, so use that as your guide for
6666
where to put new methods.
6767

6868
Code is organized in files also based pretty closely on the GitHub API
69-
documentation, following the format `{service}_{api}.go`. For example, methods
69+
documentation, following the format `{service}_{api}.go`. For example, methods
7070
defined at <https://developer.github.com/v3/repos/hooks/> live in
7171
[repos_hooks.go][].
7272

73-
[GitHub API documentation]: http://developer.github.com/v3/
73+
[GitHub API documentation]: https://developer.github.com/v3/
7474
[repos_hooks.go]: https://github.com/google/go-github/blob/master/github/repos_hooks.go
7575

7676

@@ -88,18 +88,18 @@ exceptions, running `git log` should not show a bunch of branching and merging.
8888

8989
Never use the GitHub "merge" button, since it always creates a merge commit.
9090
Instead, check out the pull request locally ([these git aliases
91-
help][git-aliases]), then cherry-pick or rebase them onto master. If there are
91+
help][git-aliases]), then cherry-pick or rebase them onto master. If there are
9292
small cleanup commits, especially as a result of addressing code review
93-
comments, these should almost always be squashed down to a single commit. Don't
94-
bother squashing commits that really deserve to be separate though. If needed,
93+
comments, these should almost always be squashed down to a single commit. Don't
94+
bother squashing commits that really deserve to be separate though. If needed,
9595
feel free to amend additional small changes to the code or commit message that
9696
aren't worth going through code review for.
9797

9898
If you made any changes like squashing commits, rebasing onto master, etc, then
9999
GitHub won't recognize that this is the same commit in order to mark the pull
100-
request as "merged". So instead, amend the commit message to include a line
101-
"Fixes #0", referencing the pull request number. This would be in addition to
102-
any other "Fixes" lines for closing related issues. If you forget to do this,
100+
request as "merged". So instead, amend the commit message to include a line
101+
"Fixes #0", referencing the pull request number. This would be in addition to
102+
any other "Fixes" lines for closing related issues. If you forget to do this,
103103
you can also leave a comment on the pull request [like this][rebase-comment].
104104
If you made any other changes, it's worth noting that as well, [like
105105
this][modified-comment].

LICENSE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2929
----------
3030

3131
Some documentation is taken from the GitHub Developer site
32-
<http://developer.github.com/>, which is available under the following Creative
33-
Commons Attribution 3.0 License. This applies only to the go-github source
32+
<https://developer.github.com/>, which is available under the following Creative
33+
Commons Attribution 3.0 License. This applies only to the go-github source
3434
code and would not apply to any compiled binaries.
3535

3636
THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ repos, _, err := client.Repositories.ListByOrg("github", opt)
3737

3838
The services of a client divide the API into logical chunks and correspond to
3939
the structure of the GitHub API documentation at
40-
http://developer.github.com/v3/.
40+
https://developer.github.com/v3/.
4141

4242
### Authentication ###
4343

@@ -97,7 +97,7 @@ if _, ok := err.(*github.RateLimitError); ok {
9797
```
9898

9999
Learn more about GitHub rate limiting at
100-
http://developer.github.com/v3/#rate-limiting.
100+
https://developer.github.com/v3/#rate-limiting.
101101

102102
### Accepted Status ###
103103

examples/basicauth/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// license that can be found in the LICENSE file.
55

66
// The basicauth command demonstrates using the github.BasicAuthTransport,
7-
// including handling two-factor authentication. This won't currently work for
7+
// including handling two-factor authentication. This won't currently work for
88
// accounts that use SMS to receive one-time passwords.
99
package main
1010

@@ -36,7 +36,7 @@ func main() {
3636
client := github.NewClient(tp.Client())
3737
user, _, err := client.Users.Get("")
3838

39-
// Is this a two-factor auth error? If so, prompt for OTP and try again.
39+
// Is this a two-factor auth error? If so, prompt for OTP and try again.
4040
if _, ok := err.(*github.TwoFactorAuthError); err != nil && ok {
4141
fmt.Print("\nGitHub OTP: ")
4242
otp, _ := r.ReadString('\n')

github/activity.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ package github
88
// ActivityService handles communication with the activity related
99
// methods of the GitHub API.
1010
//
11-
// GitHub API docs: http://developer.github.com/v3/activity/
11+
// GitHub API docs: https://developer.github.com/v3/activity/
1212
type ActivityService service
1313

1414
// FeedLink represents a link to a related resource.

github/activity_events.go

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func (e *Event) Payload() (payload interface{}) {
9898

9999
// ListEvents drinks from the firehose of all public events across GitHub.
100100
//
101-
// GitHub API docs: http://developer.github.com/v3/activity/events/#list-public-events
101+
// GitHub API docs: https://developer.github.com/v3/activity/events/#list-public-events
102102
func (s *ActivityService) ListEvents(opt *ListOptions) ([]*Event, *Response, error) {
103103
u, err := addOptions("events", opt)
104104
if err != nil {
@@ -110,18 +110,18 @@ func (s *ActivityService) ListEvents(opt *ListOptions) ([]*Event, *Response, err
110110
return nil, nil, err
111111
}
112112

113-
events := new([]*Event)
114-
resp, err := s.client.Do(req, events)
113+
var events []*Event
114+
resp, err := s.client.Do(req, &events)
115115
if err != nil {
116116
return nil, resp, err
117117
}
118118

119-
return *events, resp, err
119+
return events, resp, nil
120120
}
121121

122122
// ListRepositoryEvents lists events for a repository.
123123
//
124-
// GitHub API docs: http://developer.github.com/v3/activity/events/#list-repository-events
124+
// GitHub API docs: https://developer.github.com/v3/activity/events/#list-repository-events
125125
func (s *ActivityService) ListRepositoryEvents(owner, repo string, opt *ListOptions) ([]*Event, *Response, error) {
126126
u := fmt.Sprintf("repos/%v/%v/events", owner, repo)
127127
u, err := addOptions(u, opt)
@@ -134,18 +134,18 @@ func (s *ActivityService) ListRepositoryEvents(owner, repo string, opt *ListOpti
134134
return nil, nil, err
135135
}
136136

137-
events := new([]*Event)
138-
resp, err := s.client.Do(req, events)
137+
var events []*Event
138+
resp, err := s.client.Do(req, &events)
139139
if err != nil {
140140
return nil, resp, err
141141
}
142142

143-
return *events, resp, err
143+
return events, resp, nil
144144
}
145145

146146
// ListIssueEventsForRepository lists issue events for a repository.
147147
//
148-
// GitHub API docs: http://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository
148+
// GitHub API docs: https://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository
149149
func (s *ActivityService) ListIssueEventsForRepository(owner, repo string, opt *ListOptions) ([]*IssueEvent, *Response, error) {
150150
u := fmt.Sprintf("repos/%v/%v/issues/events", owner, repo)
151151
u, err := addOptions(u, opt)
@@ -158,18 +158,18 @@ func (s *ActivityService) ListIssueEventsForRepository(owner, repo string, opt *
158158
return nil, nil, err
159159
}
160160

161-
events := new([]*IssueEvent)
162-
resp, err := s.client.Do(req, events)
161+
var events []*IssueEvent
162+
resp, err := s.client.Do(req, &events)
163163
if err != nil {
164164
return nil, resp, err
165165
}
166166

167-
return *events, resp, err
167+
return events, resp, nil
168168
}
169169

170170
// ListEventsForRepoNetwork lists public events for a network of repositories.
171171
//
172-
// GitHub API docs: http://developer.github.com/v3/activity/events/#list-public-events-for-a-network-of-repositories
172+
// GitHub API docs: https://developer.github.com/v3/activity/events/#list-public-events-for-a-network-of-repositories
173173
func (s *ActivityService) ListEventsForRepoNetwork(owner, repo string, opt *ListOptions) ([]*Event, *Response, error) {
174174
u := fmt.Sprintf("networks/%v/%v/events", owner, repo)
175175
u, err := addOptions(u, opt)
@@ -182,18 +182,18 @@ func (s *ActivityService) ListEventsForRepoNetwork(owner, repo string, opt *List
182182
return nil, nil, err
183183
}
184184

185-
events := new([]*Event)
186-
resp, err := s.client.Do(req, events)
185+
var events []*Event
186+
resp, err := s.client.Do(req, &events)
187187
if err != nil {
188188
return nil, resp, err
189189
}
190190

191-
return *events, resp, err
191+
return events, resp, nil
192192
}
193193

194194
// ListEventsForOrganization lists public events for an organization.
195195
//
196-
// GitHub API docs: http://developer.github.com/v3/activity/events/#list-public-events-for-an-organization
196+
// GitHub API docs: https://developer.github.com/v3/activity/events/#list-public-events-for-an-organization
197197
func (s *ActivityService) ListEventsForOrganization(org string, opt *ListOptions) ([]*Event, *Response, error) {
198198
u := fmt.Sprintf("orgs/%v/events", org)
199199
u, err := addOptions(u, opt)
@@ -206,19 +206,19 @@ func (s *ActivityService) ListEventsForOrganization(org string, opt *ListOptions
206206
return nil, nil, err
207207
}
208208

209-
events := new([]*Event)
210-
resp, err := s.client.Do(req, events)
209+
var events []*Event
210+
resp, err := s.client.Do(req, &events)
211211
if err != nil {
212212
return nil, resp, err
213213
}
214214

215-
return *events, resp, err
215+
return events, resp, nil
216216
}
217217

218218
// ListEventsPerformedByUser lists the events performed by a user. If publicOnly is
219219
// true, only public events will be returned.
220220
//
221-
// GitHub API docs: http://developer.github.com/v3/activity/events/#list-events-performed-by-a-user
221+
// GitHub API docs: https://developer.github.com/v3/activity/events/#list-events-performed-by-a-user
222222
func (s *ActivityService) ListEventsPerformedByUser(user string, publicOnly bool, opt *ListOptions) ([]*Event, *Response, error) {
223223
var u string
224224
if publicOnly {
@@ -236,19 +236,19 @@ func (s *ActivityService) ListEventsPerformedByUser(user string, publicOnly bool
236236
return nil, nil, err
237237
}
238238

239-
events := new([]*Event)
240-
resp, err := s.client.Do(req, events)
239+
var events []*Event
240+
resp, err := s.client.Do(req, &events)
241241
if err != nil {
242242
return nil, resp, err
243243
}
244244

245-
return *events, resp, err
245+
return events, resp, nil
246246
}
247247

248248
// ListEventsReceivedByUser lists the events received by a user. If publicOnly is
249249
// true, only public events will be returned.
250250
//
251-
// GitHub API docs: http://developer.github.com/v3/activity/events/#list-events-that-a-user-has-received
251+
// GitHub API docs: https://developer.github.com/v3/activity/events/#list-events-that-a-user-has-received
252252
func (s *ActivityService) ListEventsReceivedByUser(user string, publicOnly bool, opt *ListOptions) ([]*Event, *Response, error) {
253253
var u string
254254
if publicOnly {
@@ -266,19 +266,19 @@ func (s *ActivityService) ListEventsReceivedByUser(user string, publicOnly bool,
266266
return nil, nil, err
267267
}
268268

269-
events := new([]*Event)
270-
resp, err := s.client.Do(req, events)
269+
var events []*Event
270+
resp, err := s.client.Do(req, &events)
271271
if err != nil {
272272
return nil, resp, err
273273
}
274274

275-
return *events, resp, err
275+
return events, resp, nil
276276
}
277277

278278
// ListUserEventsForOrganization provides the user’s organization dashboard. You
279279
// must be authenticated as the user to view this.
280280
//
281-
// GitHub API docs: http://developer.github.com/v3/activity/events/#list-events-for-an-organization
281+
// GitHub API docs: https://developer.github.com/v3/activity/events/#list-events-for-an-organization
282282
func (s *ActivityService) ListUserEventsForOrganization(org, user string, opt *ListOptions) ([]*Event, *Response, error) {
283283
u := fmt.Sprintf("users/%v/events/orgs/%v", user, org)
284284
u, err := addOptions(u, opt)
@@ -291,11 +291,11 @@ func (s *ActivityService) ListUserEventsForOrganization(org, user string, opt *L
291291
return nil, nil, err
292292
}
293293

294-
events := new([]*Event)
295-
resp, err := s.client.Do(req, events)
294+
var events []*Event
295+
resp, err := s.client.Do(req, &events)
296296
if err != nil {
297297
return nil, resp, err
298298
}
299299

300-
return *events, resp, err
300+
return events, resp, nil
301301
}

0 commit comments

Comments
 (0)