mirror of https://github.com/knative/docs.git
fix go redirect (#5531)
* fix redirect * clean up and ignore some repos
This commit is contained in:
parent
1106ea668d
commit
48ed3a4214
|
@ -5,75 +5,73 @@
|
||||||
#
|
#
|
||||||
# To regenerate, run:
|
# To regenerate, run:
|
||||||
# go run ./tools/redir-gen/
|
# go run ./tools/redir-gen/
|
||||||
/actions/* go-get=1 /golang/actions.html 200
|
/actions/* go-get=:go-get /golang/actions.html 200
|
||||||
/async-component/* go-get=1 /golang/async-component.html 200
|
/async-component/* go-get=:go-get /golang/async-component.html 200
|
||||||
/caching/* go-get=1 /golang/caching.html 200
|
/caching/* go-get=:go-get /golang/caching.html 200
|
||||||
/client/* go-get=1 /golang/client.html 200
|
/client/* go-get=:go-get /golang/client.html 200
|
||||||
/client-pkg/* go-get=1 /golang/client-pkg.html 200
|
/client-pkg/* go-get=:go-get /golang/client-pkg.html 200
|
||||||
/community/* go-get=1 /golang/community.html 200
|
/community/* go-get=:go-get /golang/community.html 200
|
||||||
/container-freezer/* go-get=1 /golang/container-freezer.html 200
|
/container-freezer/* go-get=:go-get /golang/container-freezer.html 200
|
||||||
/scaling-group/* go-get=1 /golang/scaling-group.html 200
|
/control-protocol/* go-get=:go-get /golang/control-protocol.html 200
|
||||||
/control-protocol/* go-get=1 /golang/control-protocol.html 200
|
/discovery/* go-get=:go-get /golang/discovery.html 200
|
||||||
/discovery/* go-get=1 /golang/discovery.html 200
|
/docs/* go-get=:go-get /golang/docs.html 200
|
||||||
/docs/* go-get=1 /golang/docs.html 200
|
/eventing/* go-get=:go-get /golang/eventing.html 200
|
||||||
/eventing/* go-get=1 /golang/eventing.html 200
|
/eventing-autoscaler-keda/* go-get=:go-get /golang/eventing-autoscaler-keda.html 200
|
||||||
/eventing-autoscaler-keda/* go-get=1 /golang/eventing-autoscaler-keda.html 200
|
/eventing-awssqs/* go-get=:go-get /golang/eventing-awssqs.html 200
|
||||||
/eventing-awssqs/* go-get=1 /golang/eventing-awssqs.html 200
|
/eventing-ceph/* go-get=:go-get /golang/eventing-ceph.html 200
|
||||||
/eventing-ceph/* go-get=1 /golang/eventing-ceph.html 200
|
/eventing-contrib/* go-get=:go-get /golang/eventing-contrib.html 200
|
||||||
/eventing-contrib/* go-get=1 /golang/eventing-contrib.html 200
|
/eventing-couchdb/* go-get=:go-get /golang/eventing-couchdb.html 200
|
||||||
/eventing-couchdb/* go-get=1 /golang/eventing-couchdb.html 200
|
/eventing-github/* go-get=:go-get /golang/eventing-github.html 200
|
||||||
/eventing-istio/* go-get=1 /golang/eventing-istio.html 200
|
/eventing-gitlab/* go-get=:go-get /golang/eventing-gitlab.html 200
|
||||||
/eventing-github/* go-get=1 /golang/eventing-github.html 200
|
/eventing-istio/* go-get=:go-get /golang/eventing-istio.html 200
|
||||||
/eventing-gitlab/* go-get=1 /golang/eventing-gitlab.html 200
|
/eventing-kafka/* go-get=:go-get /golang/eventing-kafka.html 200
|
||||||
/eventing-kafka/* go-get=1 /golang/eventing-kafka.html 200
|
/eventing-kafka-broker/* go-get=:go-get /golang/eventing-kafka-broker.html 200
|
||||||
/eventing-kafka-broker/* go-get=1 /golang/eventing-kafka-broker.html 200
|
/eventing-kogito/* go-get=:go-get /golang/eventing-kogito.html 200
|
||||||
/eventing-kogito/* go-get=1 /golang/eventing-kogito.html 200
|
/eventing-natss/* go-get=:go-get /golang/eventing-natss.html 200
|
||||||
/eventing-natss/* go-get=1 /golang/eventing-natss.html 200
|
/eventing-prometheus/* go-get=:go-get /golang/eventing-prometheus.html 200
|
||||||
/eventing-prometheus/* go-get=1 /golang/eventing-prometheus.html 200
|
/eventing-rabbitmq/* go-get=:go-get /golang/eventing-rabbitmq.html 200
|
||||||
/eventing-rabbitmq/* go-get=1 /golang/eventing-rabbitmq.html 200
|
/eventing-redis/* go-get=:go-get /golang/eventing-redis.html 200
|
||||||
/eventing-redis/* go-get=1 /golang/eventing-redis.html 200
|
/func/* go-get=:go-get /golang/func.html 200
|
||||||
/func/* go-get=1 /golang/func.html 200
|
/func-go/* go-get=:go-get /golang/func-go.html 200
|
||||||
/func-tastic/* go-get=1 /golang/func-tastic.html 200
|
/func-tastic/* go-get=:go-get /golang/func-tastic.html 200
|
||||||
/hack/* go-get=1 /golang/hack.html 200
|
/hack/* go-get=:go-get /golang/hack.html 200
|
||||||
/homebrew-client/* go-get=1 /golang/homebrew-client.html 200
|
/homebrew-client/* go-get=:go-get /golang/homebrew-client.html 200
|
||||||
/homebrew-kn-plugins/* go-get=1 /golang/homebrew-kn-plugins.html 200
|
/homebrew-kn-plugins/* go-get=:go-get /golang/homebrew-kn-plugins.html 200
|
||||||
/infra/* go-get=1 /golang/infra.html 200
|
/infra/* go-get=:go-get /golang/infra.html 200
|
||||||
/kn-plugin-admin/* go-get=1 /golang/kn-plugin-admin.html 200
|
/kn-plugin-admin/* go-get=:go-get /golang/kn-plugin-admin.html 200
|
||||||
/kn-plugin-diag/* go-get=1 /golang/kn-plugin-diag.html 200
|
/kn-plugin-diag/* go-get=:go-get /golang/kn-plugin-diag.html 200
|
||||||
/kn-plugin-event/* go-get=1 /golang/kn-plugin-event.html 200
|
/kn-plugin-event/* go-get=:go-get /golang/kn-plugin-event.html 200
|
||||||
/kn-plugin-func/* go-get=1 /golang/kn-plugin-func.html 200
|
/kn-plugin-migration/* go-get=:go-get /golang/kn-plugin-migration.html 200
|
||||||
/kn-plugin-migration/* go-get=1 /golang/kn-plugin-migration.html 200
|
/kn-plugin-operator/* go-get=:go-get /golang/kn-plugin-operator.html 200
|
||||||
/kn-plugin-operator/* go-get=1 /golang/kn-plugin-operator.html 200
|
/kn-plugin-quickstart/* go-get=:go-get /golang/kn-plugin-quickstart.html 200
|
||||||
/kn-plugin-quickstart/* go-get=1 /golang/kn-plugin-quickstart.html 200
|
/kn-plugin-sample/* go-get=:go-get /golang/kn-plugin-sample.html 200
|
||||||
/kn-plugin-sample/* go-get=1 /golang/kn-plugin-sample.html 200
|
/kn-plugin-service-log/* go-get=:go-get /golang/kn-plugin-service-log.html 200
|
||||||
/kn-plugin-service-log/* go-get=1 /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-kafka/* go-get=1 /golang/kn-plugin-source-kafka.html 200
|
/kn-plugin-source-kamelet/* go-get=:go-get /golang/kn-plugin-source-kamelet.html 200
|
||||||
/kn-plugin-source-kamelet/* go-get=1 /golang/kn-plugin-source-kamelet.html 200
|
/knobots/* go-get=:go-get /golang/knobots.html 200
|
||||||
/kn-plugin-source-pkg/* go-get=1 /golang/kn-plugin-source-pkg.html 200
|
/kperf/* go-get=:go-get /golang/kperf.html 200
|
||||||
/knobots/* go-get=1 /golang/knobots.html 200
|
/monitoring/* go-get=:go-get /golang/monitoring.html 200
|
||||||
/kperf/* go-get=1 /golang/kperf.html 200
|
/net-certmanager/* go-get=:go-get /golang/net-certmanager.html 200
|
||||||
/monitoring/* go-get=1 /golang/monitoring.html 200
|
/net-contour/* go-get=:go-get /golang/net-contour.html 200
|
||||||
/net-certmanager/* go-get=1 /golang/net-certmanager.html 200
|
/net-gateway-api/* go-get=:go-get /golang/net-gateway-api.html 200
|
||||||
/net-contour/* go-get=1 /golang/net-contour.html 200
|
/net-http01/* go-get=:go-get /golang/net-http01.html 200
|
||||||
/net-gateway-api/* go-get=1 /golang/net-gateway-api.html 200
|
/net-istio/* go-get=:go-get /golang/net-istio.html 200
|
||||||
/net-http01/* go-get=1 /golang/net-http01.html 200
|
/net-kourier/* go-get=:go-get /golang/net-kourier.html 200
|
||||||
/net-istio/* go-get=1 /golang/net-istio.html 200
|
/networking/* go-get=:go-get /golang/networking.html 200
|
||||||
/net-kourier/* go-get=1 /golang/net-kourier.html 200
|
/operator/* go-get=:go-get /golang/operator.html 200
|
||||||
/networking/* go-get=1 /golang/networking.html 200
|
/pkg/* go-get=:go-get /golang/pkg.html 200
|
||||||
/operator/* go-get=1 /golang/operator.html 200
|
|
||||||
/pkg/* go-get=1 /golang/pkg.html 200
|
|
||||||
/pkg/* https://pkg.go.dev/knative.dev/pkg/:splat
|
/pkg/* https://pkg.go.dev/knative.dev/pkg/:splat
|
||||||
/reconciler-test/* go-get=1 /golang/reconciler-test.html 200
|
/reconciler-test/* go-get=:go-get /golang/reconciler-test.html 200
|
||||||
/release/* go-get=1 /golang/release.html 200
|
/release/* go-get=:go-get /golang/release.html 200
|
||||||
/runtime/* go-get=1 /golang/func-go.html 200
|
/sample-controller/* go-get=:go-get /golang/sample-controller.html 200
|
||||||
/sample-controller/* go-get=1 /golang/sample-controller.html 200
|
/sample-source/* go-get=:go-get /golang/sample-source.html 200
|
||||||
/sample-source/* go-get=1 /golang/sample-source.html 200
|
/scaling-group/* go-get=:go-get /golang/scaling-group.html 200
|
||||||
/security-guard/* go-get=1 /golang/security-guard.html 200
|
/security-guard/* go-get=:go-get /golang/security-guard.html 200
|
||||||
/security-guard/* https://pkg.go.dev/knative.dev/security-guard/:splat
|
/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
|
/serving/* https://pkg.go.dev/knative.dev/serving/:splat
|
||||||
/specs/* go-get=1 /golang/specs.html 200
|
/specs/* go-get=:go-get /golang/specs.html 200
|
||||||
/test-infra/* go-get=1 /golang/test-infra.html 200
|
/test-infra/* go-get=:go-get /golang/test-infra.html 200
|
||||||
/toolbox/* go-get=1 /golang/toolbox.html 200
|
/toolbox/* go-get=:go-get /golang/toolbox.html 200
|
||||||
/ux/* go-get=1 /golang/ux.html 200
|
/ux/* go-get=:go-get /golang/ux.html 200
|
||||||
/wg-repository/* go-get=1 /golang/wg-repository.html 200
|
/wg-repository/* go-get=:go-get /golang/wg-repository.html 200
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
<html><head>
|
|
||||||
<meta name="go-import" content="knative.dev/actions-downstream-test git https://github.com/knative-sandbox/actions-downstream-test">
|
|
||||||
<meta name="go-source" content="knative.dev/actions-downstream-test https://github.com/knative-sandbox/actions-downstream-test https://github.com/knative-sandbox/actions-downstream-test/tree/main{/dir} https://github.com/knative-sandbox/actions-downstream-test/blob/main{/dir}/{file}#L{line}">
|
|
||||||
</head></html>
|
|
|
@ -1,4 +0,0 @@
|
||||||
<html><head>
|
|
||||||
<meta name="go-import" content="knative.dev/actions-kind git https://github.com/knative-sandbox/actions-kind">
|
|
||||||
<meta name="go-source" content="knative.dev/actions-kind https://github.com/knative-sandbox/actions-kind https://github.com/knative-sandbox/actions-kind/tree/main{/dir} https://github.com/knative-sandbox/actions-kind/blob/main{/dir}/{file}#L{line}">
|
|
||||||
</head></html>
|
|
|
@ -1,4 +0,0 @@
|
||||||
<html><head>
|
|
||||||
<meta name="go-import" content="knative.dev/build-spike git https://github.com/knative-sandbox/build-spike">
|
|
||||||
<meta name="go-source" content="knative.dev/build-spike https://github.com/knative-sandbox/build-spike https://github.com/knative-sandbox/build-spike/tree/main{/dir} https://github.com/knative-sandbox/build-spike/blob/main{/dir}/{file}#L{line}">
|
|
||||||
</head></html>
|
|
|
@ -1,4 +0,0 @@
|
||||||
<html><head>
|
|
||||||
<meta name="go-import" content="knative.dev/integration git https://github.com/knative-sandbox/integration">
|
|
||||||
<meta name="go-source" content="knative.dev/integration https://github.com/knative-sandbox/integration https://github.com/knative-sandbox/integration/tree/main{/dir} https://github.com/knative-sandbox/integration/blob/main{/dir}/{file}#L{line}">
|
|
||||||
</head></html>
|
|
|
@ -1,4 +0,0 @@
|
||||||
<html><head>
|
|
||||||
<meta name="go-import" content="knative.dev/kn-plugin-source-pkg git https://github.com/knative-sandbox/kn-plugin-source-pkg">
|
|
||||||
<meta name="go-source" content="knative.dev/kn-plugin-source-pkg https://github.com/knative-sandbox/kn-plugin-source-pkg https://github.com/knative-sandbox/kn-plugin-source-pkg/tree/main{/dir} https://github.com/knative-sandbox/kn-plugin-source-pkg/blob/main{/dir}/{file}#L{line}">
|
|
||||||
</head></html>
|
|
|
@ -1,4 +0,0 @@
|
||||||
<html><head>
|
|
||||||
<meta name="go-import" content="knative.dev/website git https://github.com/knative/website">
|
|
||||||
<meta name="go-source" content="knative.dev/website https://github.com/knative/website https://github.com/knative/website/tree/main{/dir} https://github.com/knative/website/blob/main{/dir}/{file}#L{line}">
|
|
||||||
</head></html>
|
|
|
@ -29,11 +29,23 @@ var (
|
||||||
knativeOrgs = []string{"knative", "knative-sandbox"}
|
knativeOrgs = []string{"knative", "knative-sandbox"}
|
||||||
allowedRepoRe = regexp.MustCompile("^[a-z][-a-z0-9]+$")
|
allowedRepoRe = regexp.MustCompile("^[a-z][-a-z0-9]+$")
|
||||||
archivedExceptions = []string{"eventing-contrib"}
|
archivedExceptions = []string{"eventing-contrib"}
|
||||||
|
ignoreRepos = []string{
|
||||||
|
"actions",
|
||||||
|
"community",
|
||||||
|
"docs",
|
||||||
|
"knobots",
|
||||||
|
"monitoring",
|
||||||
|
"release",
|
||||||
|
}
|
||||||
|
|
||||||
// Repos known to contain Go libraries, so that requesting
|
// Repos known to contain Go libraries, so that requesting
|
||||||
// https://knative.dev/<repo> in a browser should redirect to
|
// https://knative.dev/<repo> in a browser should redirect to
|
||||||
// https://pkg.go.dev/knative.dev/<repo>
|
// https://pkg.go.dev/knative.dev/<repo>
|
||||||
redirectingGoRepos = []string{"pkg", "serving", "security-guard"}
|
redirectingGoRepos = []string{"pkg", "serving", "security-guard"}
|
||||||
|
|
||||||
|
repoToModule = map[string]string{
|
||||||
|
"func-go": "runtime",
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
// repoInfo provides a simple holder for GitHub repo information needed to
|
// repoInfo provides a simple holder for GitHub repo information needed to
|
||||||
|
@ -44,6 +56,11 @@ type repoInfo struct {
|
||||||
// Repo is the name of the github repo within the organizatiøon (e.g.
|
// Repo is the name of the github repo within the organizatiøon (e.g.
|
||||||
// "serving", NOT "knative/serving")
|
// "serving", NOT "knative/serving")
|
||||||
Repo string
|
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
|
// DefaultBranch is the name of the default branch. This will be changing
|
||||||
// from "master" to "main" over time.
|
// from "master" to "main" over time.
|
||||||
DefaultBranch string
|
DefaultBranch string
|
||||||
|
@ -88,7 +105,14 @@ func fetchRepos(orgs []string) ([]repoInfo, error) {
|
||||||
log.Print("Ignoring archived repo: ", *r.Name)
|
log.Print("Ignoring archived repo: ", *r.Name)
|
||||||
continue
|
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 {
|
if resp.NextPage == 0 {
|
||||||
break
|
break
|
||||||
|
@ -101,11 +125,11 @@ func fetchRepos(orgs []string) ([]repoInfo, error) {
|
||||||
|
|
||||||
const (
|
const (
|
||||||
goHTML = `<html><head>
|
goHTML = `<html><head>
|
||||||
<meta name="go-import" content="knative.dev/{{.Repo}} git https://github.com/{{.Org}}/{{.Repo}}">
|
<meta name="go-import" content="knative.dev/{{.Module}} 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-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>
|
</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
|
godocRedirText = `/{{.Repo}}/* https://pkg.go.dev/knative.dev/{{.Repo}}/:splat
|
||||||
`
|
`
|
||||||
|
|
Loading…
Reference in New Issue