Skip to content

Commit f497ba2

Browse files
thisisaaronlandthisisaaronland
andauthored
Update to use google/go-github/v71 (#29)
* update to use v71, does not compile yet * finish updating to reflect v71 changes --------- Co-authored-by: thisisaaronland <thisisaaronland@localhost>
1 parent 3f75eb0 commit f497ba2

File tree

237 files changed

+34717
-21151
lines changed

Some content is hidden

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

237 files changed

+34717
-21151
lines changed

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ GOMOD=$(shell test -f "go.work" && echo "readonly" || echo "vendor")
22
LDFLAGS=-s -w
33

44
tools:
5+
@make cli
6+
7+
cli:
58
go build -mod $(GOMOD) -ldflags="$(LDFLAGS)" -o bin/wof-add-files cmd/wof-add-files/main.go
69
go build -mod $(GOMOD) -ldflags="$(LDFLAGS)" -o bin/wof-clone-repos cmd/wof-clone-repos/main.go
710
go build -mod $(GOMOD) -ldflags="$(LDFLAGS)" -o bin/wof-create-repos cmd/wof-create-repo/main.go
@@ -11,3 +14,6 @@ tools:
1114
go build -mod $(GOMOD) -ldflags="$(LDFLAGS)" -o bin/wof-list-hooks cmd/wof-list-hooks/main.go
1215
go build -mod $(GOMOD) -ldflags="$(LDFLAGS)" -o bin/wof-list-updates cmd/wof-list-updates/main.go
1316
go build -mod $(GOMOD) -ldflags="$(LDFLAGS)" -o bin/wof-rate-limits cmd/wof-rate-limits/main.go
17+
18+
bump-github:
19+
find . -name '*.go' | xargs perl -i -p -e 's/github.com\/google\/go-github\/v$(PREVIOUS)/github.com\/google\/go-github\/v$(NEW)/g'

cmd/wof-add-files/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"context"
55
"flag"
66
"fmt"
7-
"github.com/google/go-github/v48/github"
7+
"github.com/google/go-github/v71/github"
88
"github.com/sfomuseum/go-flags/multi"
99
"github.com/whosonfirst/go-whosonfirst-github/organizations"
1010
"github.com/whosonfirst/go-whosonfirst-github/util"

cmd/wof-clone-repos/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"sync"
1414
"time"
1515

16-
"github.com/google/go-github/v48/github"
16+
"github.com/google/go-github/v71/github"
1717
"github.com/whosonfirst/go-whosonfirst-github/util"
1818
)
1919

cmd/wof-create-hook/main.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"fmt"
1212
"log"
1313

14-
"github.com/google/go-github/v48/github"
14+
"github.com/google/go-github/v71/github"
1515
"github.com/sfomuseum/go-flags/multi"
1616
"github.com/whosonfirst/go-whosonfirst-github/organizations"
1717
"github.com/whosonfirst/go-whosonfirst-github/util"
@@ -51,11 +51,11 @@ func main() {
5151
log.Fatal(err)
5252
}
5353

54-
hook_config := make(map[string]interface{})
55-
56-
hook_config["url"] = *url
57-
hook_config["content_type"] = *content_type
58-
hook_config["secret"] = *secret
54+
hook_config := &github.HookConfig{
55+
URL: url,
56+
ContentType: content_type,
57+
Secret: secret,
58+
}
5959

6060
hook := github.Hook{
6161
// Name: name,
@@ -97,7 +97,7 @@ func main() {
9797

9898
for _, h := range hooks {
9999

100-
if h.Config["url"] == *url {
100+
if h.Config.URL == url {
101101
has_hook = true
102102
break
103103
}

cmd/wof-list-hooks/main.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"os"
1414
"strings"
1515

16-
"github.com/google/go-github/v48/github"
16+
"github.com/google/go-github/v71/github"
1717
"github.com/whosonfirst/go-whosonfirst-github/util"
1818
)
1919

@@ -109,13 +109,9 @@ func main() {
109109

110110
if *hook_prefix != "" {
111111

112-
v, ok := h.Config["url"]
112+
url := h.Config.URL
113113

114-
if !ok {
115-
continue
116-
}
117-
118-
if !strings.HasPrefix(v.(string), *hook_prefix) {
114+
if !strings.HasPrefix(*url, *hook_prefix) {
119115
continue
120116
}
121117
}

cmd/wof-update-hook/main.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"log"
1515
"strings"
1616

17-
"github.com/google/go-github/v48/github"
17+
"github.com/google/go-github/v71/github"
1818
"github.com/whosonfirst/go-whosonfirst-github/util"
1919
)
2020

@@ -80,9 +80,9 @@ func main() {
8080

8181
for _, h := range hooks {
8282

83-
hook_url := h.Config["url"].(string)
83+
hook_url := h.Config.URL
8484

85-
if strings.HasPrefix(hook_url, *url) {
85+
if strings.HasPrefix(*hook_url, *url) {
8686

8787
u := update{
8888
Repo: *r.Name,
@@ -108,11 +108,11 @@ func main() {
108108
hook := u.Hook
109109

110110
if *secret != "" {
111-
hook.Config["secret"] = *secret
111+
hook.Config.Secret = secret
112112
}
113113

114114
if *content_type != "" {
115-
hook.Config["content_type"] = *content_type
115+
hook.Config.ContentType = content_type
116116
}
117117

118118
hook.Active = active

go.mod

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/whosonfirst/go-whosonfirst-github
33
go 1.24.2
44

55
require (
6-
github.com/google/go-github/v48 v48.2.0
6+
github.com/google/go-github/v71 v71.0.0
77
github.com/sfomuseum/go-flags v0.10.0
88
github.com/sfomuseum/iso8601duration v1.1.0
99
github.com/sfomuseum/runtimevar v1.3.0
@@ -46,7 +46,6 @@ require (
4646
github.com/whosonfirst/go-ioutil v1.0.2 // indirect
4747
go.opencensus.io v0.24.0 // indirect
4848
gocloud.dev v0.41.0 // indirect
49-
golang.org/x/crypto v0.36.0 // indirect
5049
golang.org/x/net v0.38.0 // indirect
5150
golang.org/x/sys v0.31.0 // indirect
5251
golang.org/x/text v0.23.0 // indirect

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
130130
github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
131131
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
132132
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
133-
github.com/google/go-github/v48 v48.2.0 h1:68puzySE6WqUY9KWmpOsDEQfDZsso98rT6pZcz9HqcE=
134-
github.com/google/go-github/v48 v48.2.0/go.mod h1:dDlehKBDo850ZPvCTK0sEqTCVWcrGl2LcDiajkYi89Y=
133+
github.com/google/go-github/v71 v71.0.0 h1:Zi16OymGKZZMm8ZliffVVJ/Q9YZreDKONCr+WUd0Z30=
134+
github.com/google/go-github/v71 v71.0.0/go.mod h1:URZXObp2BLlMjwu0O8g4y6VBneUj2bCHgnI8FfgZ51M=
135135
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
136136
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
137137
github.com/google/go-replayers/grpcreplay v1.3.0 h1:1Keyy0m1sIpqstQmgz307zhiJ1pV4uIlFds5weTmxbo=

organizations/organizations.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"strings"
88
"time"
99

10-
"github.com/google/go-github/v48/github"
10+
"github.com/google/go-github/v71/github"
1111
"github.com/whosonfirst/go-whosonfirst-github/util"
1212
)
1313

@@ -173,11 +173,11 @@ func ListReposWithCallback(org string, opts *ListOptions, cb func(repo *github.R
173173
}
174174
}
175175

176-
// https://pkg.go.dev/github.com/google/go-github/v48@v48.2.0/github#RepositoriesService.ListCommits
177-
// https://pkg.go.dev/github.com/google/go-github/v48@v48.2.0/github#CommitsListOptions
178-
// https://pkg.go.dev/github.com/google/go-github/v48@v48.2.0/github#RepositoryCommit
179-
// https://pkg.go.dev/github.com/google/go-github/v48@v48.2.0/github#Commit
180-
// https://pkg.go.dev/github.com/google/go-github/v48@v48.2.0/github#CommitFile
176+
// https://pkg.go.dev/github.com/google/go-github/v71@v48.2.0/github#RepositoriesService.ListCommits
177+
// https://pkg.go.dev/github.com/google/go-github/v71@v48.2.0/github#CommitsListOptions
178+
// https://pkg.go.dev/github.com/google/go-github/v71@v48.2.0/github#RepositoryCommit
179+
// https://pkg.go.dev/github.com/google/go-github/v71@v48.2.0/github#Commit
180+
// https://pkg.go.dev/github.com/google/go-github/v71@v48.2.0/github#CommitFile
181181

182182
if opts.EnsureCommits {
183183

repositories/repositories.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"sync"
1010
"time"
1111

12-
"github.com/google/go-github/v48/github"
12+
"github.com/google/go-github/v71/github"
1313
"github.com/whosonfirst/go-whosonfirst-github/util"
1414
)
1515

@@ -74,9 +74,9 @@ func ListCommitFilesWithCallback(ctx context.Context, opts *ListCommitFilesOptio
7474

7575
slog.Debug("Commit", "sha", *rc.SHA)
7676

77-
// https://pkg.go.dev/github.com/google/go-github/v48/github#RepositoriesService.GetCommit
78-
// https://pkg.go.dev/github.com/google/go-github/v48/github#Response
79-
// https://pkg.go.dev/github.com/google/go-github/v48/github#ListOptions
77+
// https://pkg.go.dev/github.com/google/go-github/v71/github#RepositoriesService.GetCommit
78+
// https://pkg.go.dev/github.com/google/go-github/v71/github#Response
79+
// https://pkg.go.dev/github.com/google/go-github/v71/github#ListOptions
8080

8181
page := 1
8282

0 commit comments

Comments
 (0)