dmitri.shuralyov.com/app/changes/...

Start on a fs service implementation; use mock data.
dmitshur committed 6 years ago commit 87dc1319a211ce05b206f36eca0e438d32257802
Collapse all
cmd/changesdev/main.go
@@ -26,10 +26,11 @@ import (
	"os"
	"strings"

	"dmitri.shuralyov.com/changes"
	"dmitri.shuralyov.com/changes/app"
	"dmitri.shuralyov.com/changes/fs"
	"dmitri.shuralyov.com/changes/gerritapi"
	"dmitri.shuralyov.com/changes/githubapi"
	"github.com/andygrunwald/go-gerrit"
	"github.com/google/go-github/github"
	"github.com/gregjones/httpcache"
@@ -43,11 +44,11 @@ var httpFlag = flag.String("http", ":8080", "Listen for HTTP connections on this

func main() {
	flag.Parse()

	var service changes.Service
	switch 0 {
	switch 3 {
	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")
@@ -84,10 +85,13 @@ func main() {
		if err != nil {
			log.Fatalln(err)
		}

		service = maintner.NewService(corpus)*/

	case 3:
		service = &fs.Service{}
	}

	changesOpt := changesapp.Options{
		HeadPre: `<style type="text/css">
	body {
@@ -125,15 +129,16 @@ func main() {
			req.URL.Path = "/"
		}
		//req = req.WithContext(context.WithValue(req.Context(), changesapp.RepoSpecContextKey, "github.com/google/go-github"))
		//req = req.WithContext(context.WithValue(req.Context(), changesapp.RepoSpecContextKey, "github.com/dustin/go-humanize"))
		//req = req.WithContext(context.WithValue(req.Context(), changesapp.RepoSpecContextKey, "github.com/neugram/ng"))
		req = req.WithContext(context.WithValue(req.Context(), changesapp.RepoSpecContextKey, "github.com/golang/scratch"))
		//req = req.WithContext(context.WithValue(req.Context(), changesapp.RepoSpecContextKey, "github.com/golang/scratch"))
		//req = req.WithContext(context.WithValue(req.Context(), changesapp.RepoSpecContextKey, "go.googlesource.com/go"))
		//req = req.WithContext(context.WithValue(req.Context(), changesapp.RepoSpecContextKey, "go.googlesource.com/tools"))
		//req = req.WithContext(context.WithValue(req.Context(), changesapp.RepoSpecContextKey, "go.googlesource.com/build"))
		//req = req.WithContext(context.WithValue(req.Context(), changesapp.RepoSpecContextKey, "upspin.googlesource.com/upspin"))
		req = req.WithContext(context.WithValue(req.Context(), changesapp.RepoSpecContextKey, "dmitri.shuralyov.com/font/woff2"))
		req = req.WithContext(context.WithValue(req.Context(), changesapp.BaseURIContextKey, "/changes"))
		changesApp.ServeHTTP(w, req)
	})
	http.Handle("/changes", issuesHandler)
	http.Handle("/changes/", issuesHandler)