You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[](https://groups.google.com/group/go-github)
@@ -24,29 +24,29 @@ If you're interested in using the [GraphQL API v4][], the recommended library is
24
24
go-github is compatible with modern Go releases in module mode, with Go installed:
25
25
26
26
```bash
27
-
go get github.com/google/go-github/v54
27
+
go get github.com/google/go-github/v55
28
28
```
29
29
30
30
will resolve and add the package to the current development module, along with its dependencies.
31
31
32
32
Alternatively the same can be achieved if you use import in a package:
33
33
34
34
```go
35
-
import"github.com/google/go-github/v54/github"
35
+
import"github.com/google/go-github/v55/github"
36
36
```
37
37
38
38
and run `go get` without parameters.
39
39
40
40
Finally, to use the top-of-trunk version of this repo, use the following command:
41
41
42
42
```bash
43
-
go get github.com/google/go-github/v54@master
43
+
go get github.com/google/go-github/v55@master
44
44
```
45
45
46
46
## Usage ##
47
47
48
48
```go
49
-
import"github.com/google/go-github/v54/github"// with go modules enabled (GO111MODULE=on or outside GOPATH)
49
+
import"github.com/google/go-github/v55/github"// with go modules enabled (GO111MODULE=on or outside GOPATH)
50
50
import"github.com/google/go-github/github"// with go modules disabled
51
51
```
52
52
@@ -84,36 +84,18 @@ For more sample code snippets, head over to the
84
84
85
85
### Authentication ###
86
86
87
-
The go-github library does not directly handle authentication. Instead, when
88
-
creating a new client, pass an `http.Client` that can handle authentication for
89
-
you. The easiest and recommended way to do this is using the [oauth2][]
90
-
library, but you can always use any other library that provides an
91
-
`http.Client`. If you have an OAuth2 access token (for example, a [personal
92
-
API token][]), you can use it with the oauth2 library using:
87
+
Use the `WithAuthToken` method to configure your client to authenticate using an
88
+
OAuth token (for example, a [personal access token][]). This is what is needed
89
+
for a majority of use cases aside from GitHub Apps.
93
90
94
91
```go
95
-
import"golang.org/x/oauth2"
96
-
97
-
funcmain() {
98
-
ctx:= context.Background()
99
-
ts:= oauth2.StaticTokenSource(
100
-
&oauth2.Token{AccessToken: "... your access token ..."},
101
-
)
102
-
tc:= oauth2.NewClient(ctx, ts)
103
-
104
-
client:= github.NewClient(tc)
105
-
106
-
// list all repositories for the authenticated user
log.Fatal("You need to specify a non-empty value for the flags `-source-owner`, `-source-repo`, `-commit-branch`, `-files`, `-author-name` and `-author-email`")
0 commit comments