Skip to content

Commit

Permalink
fix redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
dprotaso committed Apr 12, 2023
1 parent 77a5b39 commit 6bf467a
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 75 deletions.
136 changes: 67 additions & 69 deletions golang/_redirects
Original file line number Diff line number Diff line change
Expand Up @@ -5,75 +5,73 @@
#
# To regenerate, run:
# go run ./tools/redir-gen/
/actions/* go-get=1 /golang/actions.html 200
/async-component/* go-get=1 /golang/async-component.html 200
/caching/* go-get=1 /golang/caching.html 200
/client/* go-get=1 /golang/client.html 200
/client-pkg/* go-get=1 /golang/client-pkg.html 200
/community/* go-get=1 /golang/community.html 200
/container-freezer/* go-get=1 /golang/container-freezer.html 200
/scaling-group/* go-get=1 /golang/scaling-group.html 200
/control-protocol/* go-get=1 /golang/control-protocol.html 200
/discovery/* go-get=1 /golang/discovery.html 200
/docs/* go-get=1 /golang/docs.html 200
/eventing/* go-get=1 /golang/eventing.html 200
/eventing-autoscaler-keda/* go-get=1 /golang/eventing-autoscaler-keda.html 200
/eventing-awssqs/* go-get=1 /golang/eventing-awssqs.html 200
/eventing-ceph/* go-get=1 /golang/eventing-ceph.html 200
/eventing-contrib/* go-get=1 /golang/eventing-contrib.html 200
/eventing-couchdb/* go-get=1 /golang/eventing-couchdb.html 200
/eventing-istio/* go-get=1 /golang/eventing-istio.html 200
/eventing-github/* go-get=1 /golang/eventing-github.html 200
/eventing-gitlab/* go-get=1 /golang/eventing-gitlab.html 200
/eventing-kafka/* go-get=1 /golang/eventing-kafka.html 200
/eventing-kafka-broker/* go-get=1 /golang/eventing-kafka-broker.html 200
/eventing-kogito/* go-get=1 /golang/eventing-kogito.html 200
/eventing-natss/* go-get=1 /golang/eventing-natss.html 200
/eventing-prometheus/* go-get=1 /golang/eventing-prometheus.html 200
/eventing-rabbitmq/* go-get=1 /golang/eventing-rabbitmq.html 200
/eventing-redis/* go-get=1 /golang/eventing-redis.html 200
/func/* go-get=1 /golang/func.html 200
/func-tastic/* go-get=1 /golang/func-tastic.html 200
/hack/* go-get=1 /golang/hack.html 200
/homebrew-client/* go-get=1 /golang/homebrew-client.html 200
/homebrew-kn-plugins/* go-get=1 /golang/homebrew-kn-plugins.html 200
/infra/* go-get=1 /golang/infra.html 200
/kn-plugin-admin/* go-get=1 /golang/kn-plugin-admin.html 200
/kn-plugin-diag/* go-get=1 /golang/kn-plugin-diag.html 200
/kn-plugin-event/* go-get=1 /golang/kn-plugin-event.html 200
/kn-plugin-func/* go-get=1 /golang/kn-plugin-func.html 200
/kn-plugin-migration/* go-get=1 /golang/kn-plugin-migration.html 200
/kn-plugin-operator/* go-get=1 /golang/kn-plugin-operator.html 200
/kn-plugin-quickstart/* go-get=1 /golang/kn-plugin-quickstart.html 200
/kn-plugin-sample/* go-get=1 /golang/kn-plugin-sample.html 200
/kn-plugin-service-log/* go-get=1 /golang/kn-plugin-service-log.html 200
/kn-plugin-source-kafka/* go-get=1 /golang/kn-plugin-source-kafka.html 200
/kn-plugin-source-kamelet/* go-get=1 /golang/kn-plugin-source-kamelet.html 200
/kn-plugin-source-pkg/* go-get=1 /golang/kn-plugin-source-pkg.html 200
/knobots/* go-get=1 /golang/knobots.html 200
/kperf/* go-get=1 /golang/kperf.html 200
/monitoring/* go-get=1 /golang/monitoring.html 200
/net-certmanager/* go-get=1 /golang/net-certmanager.html 200
/net-contour/* go-get=1 /golang/net-contour.html 200
/net-gateway-api/* go-get=1 /golang/net-gateway-api.html 200
/net-http01/* go-get=1 /golang/net-http01.html 200
/net-istio/* go-get=1 /golang/net-istio.html 200
/net-kourier/* go-get=1 /golang/net-kourier.html 200
/networking/* go-get=1 /golang/networking.html 200
/operator/* go-get=1 /golang/operator.html 200
/pkg/* go-get=1 /golang/pkg.html 200
/actions/* go-get=:go-get /golang/actions.html 200
/async-component/* go-get=:go-get /golang/async-component.html 200
/caching/* go-get=:go-get /golang/caching.html 200
/client/* go-get=:go-get /golang/client.html 200
/client-pkg/* go-get=:go-get /golang/client-pkg.html 200
/community/* go-get=:go-get /golang/community.html 200
/container-freezer/* go-get=:go-get /golang/container-freezer.html 200
/control-protocol/* go-get=:go-get /golang/control-protocol.html 200
/discovery/* go-get=:go-get /golang/discovery.html 200
/docs/* go-get=:go-get /golang/docs.html 200
/eventing/* go-get=:go-get /golang/eventing.html 200
/eventing-autoscaler-keda/* go-get=:go-get /golang/eventing-autoscaler-keda.html 200
/eventing-awssqs/* go-get=:go-get /golang/eventing-awssqs.html 200
/eventing-ceph/* go-get=:go-get /golang/eventing-ceph.html 200
/eventing-contrib/* go-get=:go-get /golang/eventing-contrib.html 200
/eventing-couchdb/* go-get=:go-get /golang/eventing-couchdb.html 200
/eventing-github/* go-get=:go-get /golang/eventing-github.html 200
/eventing-gitlab/* go-get=:go-get /golang/eventing-gitlab.html 200
/eventing-istio/* go-get=:go-get /golang/eventing-istio.html 200
/eventing-kafka/* go-get=:go-get /golang/eventing-kafka.html 200
/eventing-kafka-broker/* go-get=:go-get /golang/eventing-kafka-broker.html 200
/eventing-kogito/* go-get=:go-get /golang/eventing-kogito.html 200
/eventing-natss/* go-get=:go-get /golang/eventing-natss.html 200
/eventing-prometheus/* go-get=:go-get /golang/eventing-prometheus.html 200
/eventing-rabbitmq/* go-get=:go-get /golang/eventing-rabbitmq.html 200
/eventing-redis/* go-get=:go-get /golang/eventing-redis.html 200
/func/* go-get=:go-get /golang/func.html 200
/func-go/* go-get=:go-get /golang/func-go.html 200
/func-tastic/* go-get=:go-get /golang/func-tastic.html 200
/hack/* go-get=:go-get /golang/hack.html 200
/homebrew-client/* go-get=:go-get /golang/homebrew-client.html 200
/homebrew-kn-plugins/* go-get=:go-get /golang/homebrew-kn-plugins.html 200
/infra/* go-get=:go-get /golang/infra.html 200
/kn-plugin-admin/* go-get=:go-get /golang/kn-plugin-admin.html 200
/kn-plugin-diag/* go-get=:go-get /golang/kn-plugin-diag.html 200
/kn-plugin-event/* go-get=:go-get /golang/kn-plugin-event.html 200
/kn-plugin-migration/* go-get=:go-get /golang/kn-plugin-migration.html 200
/kn-plugin-operator/* go-get=:go-get /golang/kn-plugin-operator.html 200
/kn-plugin-quickstart/* go-get=:go-get /golang/kn-plugin-quickstart.html 200
/kn-plugin-sample/* go-get=:go-get /golang/kn-plugin-sample.html 200
/kn-plugin-service-log/* go-get=:go-get /golang/kn-plugin-service-log.html 200
/kn-plugin-source-kafka/* go-get=:go-get /golang/kn-plugin-source-kafka.html 200
/kn-plugin-source-kamelet/* go-get=:go-get /golang/kn-plugin-source-kamelet.html 200
/knobots/* go-get=:go-get /golang/knobots.html 200
/kperf/* go-get=:go-get /golang/kperf.html 200
/monitoring/* go-get=:go-get /golang/monitoring.html 200
/net-certmanager/* go-get=:go-get /golang/net-certmanager.html 200
/net-contour/* go-get=:go-get /golang/net-contour.html 200
/net-gateway-api/* go-get=:go-get /golang/net-gateway-api.html 200
/net-http01/* go-get=:go-get /golang/net-http01.html 200
/net-istio/* go-get=:go-get /golang/net-istio.html 200
/net-kourier/* go-get=:go-get /golang/net-kourier.html 200
/networking/* go-get=:go-get /golang/networking.html 200
/operator/* go-get=:go-get /golang/operator.html 200
/pkg/* go-get=:go-get /golang/pkg.html 200
/pkg/* https://pkg.go.dev/knative.dev/pkg/:splat
/reconciler-test/* go-get=1 /golang/reconciler-test.html 200
/release/* go-get=1 /golang/release.html 200
/runtime/* go-get=1 /golang/func-go.html 200
/sample-controller/* go-get=1 /golang/sample-controller.html 200
/sample-source/* go-get=1 /golang/sample-source.html 200
/security-guard/* go-get=1 /golang/security-guard.html 200
/reconciler-test/* go-get=:go-get /golang/reconciler-test.html 200
/release/* go-get=:go-get /golang/release.html 200
/sample-controller/* go-get=:go-get /golang/sample-controller.html 200
/sample-source/* go-get=:go-get /golang/sample-source.html 200
/scaling-group/* go-get=:go-get /golang/scaling-group.html 200
/security-guard/* go-get=:go-get /golang/security-guard.html 200
/security-guard/* https://pkg.go.dev/knative.dev/security-guard/:splat
/serving/* go-get=1 /golang/serving.html 200
/serving/* go-get=:go-get /golang/serving.html 200
/serving/* https://pkg.go.dev/knative.dev/serving/:splat
/specs/* go-get=1 /golang/specs.html 200
/test-infra/* go-get=1 /golang/test-infra.html 200
/toolbox/* go-get=1 /golang/toolbox.html 200
/ux/* go-get=1 /golang/ux.html 200
/wg-repository/* go-get=1 /golang/wg-repository.html 200
/specs/* go-get=:go-get /golang/specs.html 200
/test-infra/* go-get=:go-get /golang/test-infra.html 200
/toolbox/* go-get=:go-get /golang/toolbox.html 200
/ux/* go-get=:go-get /golang/ux.html 200
/wg-repository/* go-get=:go-get /golang/wg-repository.html 200
4 changes: 2 additions & 2 deletions golang/func-go.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/runtime git https://github.com/knative-sandbox/func-go">
<meta name="go-source" content="knative.dev/runtime https://github.com/knative-sandbox/func-go https://github.com/knative-sandbox/func-go/tree/main{/dir} https://github.com/knative-sandbox/func-go/blob/main{/dir}/{file}#L{line}">
<meta name="go-import" content="knative.dev/runtime git https://github.com/knative-sandbox/func-go">
<meta name="go-source" content="knative.dev/runtime https://github.com/knative-sandbox/func-go https://github.com/knative-sandbox/func-go/tree/main{/dir} https://github.com/knative-sandbox/func-go/blob/main{/dir}/{file}#L{line}">
</head></html>
24 changes: 20 additions & 4 deletions tools/redir-gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ var (
// https://knative.dev/<repo> in a browser should redirect to
// https://pkg.go.dev/knative.dev/<repo>
redirectingGoRepos = []string{"pkg", "serving", "security-guard"}

repoToModule = map[string]string{
"func-go": "runtime",
}
)

// repoInfo provides a simple holder for GitHub repo information needed to
Expand All @@ -44,6 +48,11 @@ type repoInfo struct {
// Repo is the name of the github repo within the organizatiøon (e.g.
// "serving", NOT "knative/serving")
Repo string

// Module is the name of the github repo within the organizatiøon (e.g.
// "serving", NOT "knative/serving")
Module string

// DefaultBranch is the name of the default branch. This will be changing
// from "master" to "main" over time.
DefaultBranch string
Expand Down Expand Up @@ -88,7 +97,14 @@ func fetchRepos(orgs []string) ([]repoInfo, error) {
log.Print("Ignoring archived repo: ", *r.Name)
continue
}
allRepos = append(allRepos, repoInfo{org, *r.Name, *r.DefaultBranch})
repo := repoInfo{Org: org, Repo: *r.Name, DefaultBranch: *r.DefaultBranch}

if override, ok := repoToModule[repo.Repo]; ok {
repo.Module = override
} else {
repo.Module = repo.Repo
}
allRepos = append(allRepos, repo)
}
if resp.NextPage == 0 {
break
Expand All @@ -101,11 +117,11 @@ func fetchRepos(orgs []string) ([]repoInfo, error) {

const (
goHTML = `<html><head>
<meta name="go-import" content="knative.dev/{{.Repo}} git https://github.com/{{.Org}}/{{.Repo}}">
<meta name="go-source" content="knative.dev/{{.Repo}} https://github.com/{{.Org}}/{{.Repo}} https://github.com/{{.Org}}/{{.Repo}}/tree/{{.DefaultBranch}}{/dir} https://github.com/{{.Org}}/{{.Repo}}/blob/{{.DefaultBranch}}{/dir}/{file}#L{line}">
<meta name="go-import" content="knative.dev/{{.Module}} git https://github.com/{{.Org}}/{{.Repo}}">
<meta name="go-source" content="knative.dev/{{.Module}} https://github.com/{{.Org}}/{{.Repo}} https://github.com/{{.Org}}/{{.Repo}}/tree/{{.DefaultBranch}}{/dir} https://github.com/{{.Org}}/{{.Repo}}/blob/{{.DefaultBranch}}{/dir}/{file}#L{line}">
</head></html>
`
redirText = `/{{.Repo}}/* go-get=1 /golang/{{.Repo}}.html 200
redirText = `/{{.Repo}}/* go-get=:go-get /golang/{{.Repo}}.html 200
`
godocRedirText = `/{{.Repo}}/* https://pkg.go.dev/knative.dev/{{.Repo}}/:splat
`
Expand Down

0 comments on commit 6bf467a

Please sign in to comment.