dmitri.shuralyov.com/app/changes/cmd/changesdev

Update for githubapi API change.

Follows https://dmitri.shuralyov.com/service/change/...$commit/c4416e7845a6acd15a4c3ee4c0b71bd2b390ec42.
dmitshur committed 6 years ago commit 1e915890eeb50eebd185cec23b6333efaa72f9b3
Showing partial commit. Full Commit
Collapse all
cmd/changesdev/main.go
@@ -58,11 +58,11 @@ var httpFlag = flag.String("http", ":8080", "Listen for HTTP connections on this
func main() {
	flag.Parse()

	var usersService users.Service
	var service change.Service
	switch 0 {
	switch 1 {
	case 0:
		// Perform GitHub API authentication with provided token.
		token := os.Getenv("CHANGES_GITHUB_TOKEN")
		if token == "" {
			log.Fatalln("CHANGES_GITHUB_TOKEN env var is empty")
@@ -81,14 +81,11 @@ func main() {
		var err error
		usersService, err = ghusers.NewService(ghV3)
		if err != nil {
			log.Fatalln("ghusers.NewService:", err)
		}
		service, err = githubapi.NewService(ghV3, ghV4, nil)
		if err != nil {
			log.Fatalln(err)
		}
		service = githubapi.NewService(ghV3, ghV4, nil)

	case 1:
		cacheTransport := httpcache.NewMemoryCacheTransport()
		gerrit, err := gerrit.NewClient("https://go-review.googlesource.com/", &http.Client{Transport: cacheTransport})
		//gerrit, err := gerrit.NewClient("https://upspin-review.googlesource.com/", &http.Client{Transport: cacheTransport})
@@ -155,13 +152,14 @@ func main() {
		//req = req.WithContext(context.WithValue(req.Context(), changes.RepoSpecContextKey, "github.com/neugram/ng"))
		//req = req.WithContext(context.WithValue(req.Context(), changes.RepoSpecContextKey, "github.com/golang/scratch"))
		//req = req.WithContext(context.WithValue(req.Context(), changes.RepoSpecContextKey, "github.com/bradleyfalzon/ghinstallation"))
		//req = req.WithContext(context.WithValue(req.Context(), changes.RepoSpecContextKey, "github.com/golang/gddo"))
		//req = req.WithContext(context.WithValue(req.Context(), changes.RepoSpecContextKey, "github.com/avelino/awesome-go"))
		req = req.WithContext(context.WithValue(req.Context(), changes.RepoSpecContextKey, "github.com/travis-ci/travis-build"))
		//req = req.WithContext(context.WithValue(req.Context(), changes.RepoSpecContextKey, "github.com/travis-ci/travis-build"))
		//req = req.WithContext(context.WithValue(req.Context(), changes.RepoSpecContextKey, "github.com/primer/octicons"))
		//req = req.WithContext(context.WithValue(req.Context(), changes.RepoSpecContextKey, "go.googlesource.com/go"))
		//req = req.WithContext(context.WithValue(req.Context(), changes.RepoSpecContextKey, "github.com/golang/tools"))
		req = req.WithContext(context.WithValue(req.Context(), changes.RepoSpecContextKey, "go.googlesource.com/go"))
		//req = req.WithContext(context.WithValue(req.Context(), changes.RepoSpecContextKey, "go.googlesource.com/tools"))
		//req = req.WithContext(context.WithValue(req.Context(), changes.RepoSpecContextKey, "go.googlesource.com/build"))
		//req = req.WithContext(context.WithValue(req.Context(), changes.RepoSpecContextKey, "upspin.googlesource.com/upspin"))
		//req = req.WithContext(context.WithValue(req.Context(), changes.RepoSpecContextKey, "dmitri.shuralyov.com/font/woff2"))
		req = req.WithContext(context.WithValue(req.Context(), changes.BaseURIContextKey, "/changes"))