Generate Golang vanity URL redirects (#3806)

Moves tools/redir-gen from website to docs so we can do all the
generation here. Modifies the build script to add generated redirects to
the output.
This commit is contained in:
Julian Friedman 2021-06-15 21:39:21 +01:00 committed by GitHub
parent 9b6843dad6
commit 54f02d183b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
66 changed files with 515 additions and 0 deletions

2
golang/README.md Normal file
View File

@ -0,0 +1,2 @@
This Directory is AUTO-GENERATED. Do not modify directly, run ./tools/redir-gen.

66
golang/_redirects Executable file
View File

@ -0,0 +1,66 @@
# This file is AUTO-GENERATED
#
# DO NOT EDIT!
#
# To regenerate, run:
# redir-gen
/actions-downstream-test/* go-get=1 /golang/actions-downstream-test.html 200
/actions-kind/* go-get=1 /golang/actions-kind.html 200
/async-component/* go-get=1 /golang/async-component.html 200
/build-spike/* go-get=1 /golang/build-spike.html 200
/caching/* go-get=1 /golang/caching.html 200
/client/* go-get=1 /golang/client.html 200
/community/* go-get=1 /golang/community.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-camel/* go-get=1 /golang/eventing-camel.html 200
/eventing-ceph/* go-get=1 /golang/eventing-ceph.html 200
/eventing-couchdb/* go-get=1 /golang/eventing-couchdb.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-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
/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
/integration/* go-get=1 /golang/integration.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-migration/* go-get=1 /golang/kn-plugin-migration.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
/net-certmanager/* go-get=1 /golang/net-certmanager.html 200
/net-contour/* go-get=1 /golang/net-contour.html 200
/net-http01/* go-get=1 /golang/net-http01.html 200
/net-ingressv2/* go-get=1 /golang/net-ingressv2.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
/reconciler-test/* go-get=1 /golang/reconciler-test.html 200
/release/* go-get=1 /golang/release.html 200
/sample-controller/* go-get=1 /golang/sample-controller.html 200
/sample-source/* go-get=1 /golang/sample-source.html 200
/serving/* go-get=1 /golang/serving.html 200
/specs/* go-get=1 /golang/specs.html 200
/test-infra/* go-get=1 /golang/test-infra.html 200
/ux/* go-get=1 /golang/ux.html 200
/website/* go-get=1 /golang/website.html 200
/wg-repository/* go-get=1 /golang/wg-repository.html 200

View File

@ -0,0 +1,4 @@
<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>

4
golang/actions-kind.html Normal file
View File

@ -0,0 +1,4 @@
<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>

View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/async-component git https://github.com/knative-sandbox/async-component">
<meta name="go-source" content="knative.dev/async-component https://github.com/knative-sandbox/async-component https://github.com/knative-sandbox/async-component/tree/main{/dir} https://github.com/knative-sandbox/async-component/blob/main{/dir}/{file}#L{line}">
</head></html>

4
golang/build-spike.html Normal file
View File

@ -0,0 +1,4 @@
<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>

4
golang/caching.html Normal file
View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/caching git https://github.com/knative/caching">
<meta name="go-source" content="knative.dev/caching https://github.com/knative/caching https://github.com/knative/caching/tree/main{/dir} https://github.com/knative/caching/blob/main{/dir}/{file}#L{line}">
</head></html>

4
golang/client.html Normal file
View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/client git https://github.com/knative/client">
<meta name="go-source" content="knative.dev/client https://github.com/knative/client https://github.com/knative/client/tree/main{/dir} https://github.com/knative/client/blob/main{/dir}/{file}#L{line}">
</head></html>

4
golang/community.html Normal file
View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/community git https://github.com/knative/community">
<meta name="go-source" content="knative.dev/community https://github.com/knative/community https://github.com/knative/community/tree/main{/dir} https://github.com/knative/community/blob/main{/dir}/{file}#L{line}">
</head></html>

View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/control-protocol git https://github.com/knative-sandbox/control-protocol">
<meta name="go-source" content="knative.dev/control-protocol https://github.com/knative-sandbox/control-protocol https://github.com/knative-sandbox/control-protocol/tree/main{/dir} https://github.com/knative-sandbox/control-protocol/blob/main{/dir}/{file}#L{line}">
</head></html>

4
golang/discovery.html Normal file
View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/discovery git https://github.com/knative-sandbox/discovery">
<meta name="go-source" content="knative.dev/discovery https://github.com/knative-sandbox/discovery https://github.com/knative-sandbox/discovery/tree/main{/dir} https://github.com/knative-sandbox/discovery/blob/main{/dir}/{file}#L{line}">
</head></html>

4
golang/docs.html Normal file
View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/docs git https://github.com/knative/docs">
<meta name="go-source" content="knative.dev/docs https://github.com/knative/docs https://github.com/knative/docs/tree/mkdocs{/dir} https://github.com/knative/docs/blob/mkdocs{/dir}/{file}#L{line}">
</head></html>

View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/eventing-autoscaler-keda git https://github.com/knative-sandbox/eventing-autoscaler-keda">
<meta name="go-source" content="knative.dev/eventing-autoscaler-keda https://github.com/knative-sandbox/eventing-autoscaler-keda https://github.com/knative-sandbox/eventing-autoscaler-keda/tree/main{/dir} https://github.com/knative-sandbox/eventing-autoscaler-keda/blob/main{/dir}/{file}#L{line}">
</head></html>

View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/eventing-awssqs git https://github.com/knative-sandbox/eventing-awssqs">
<meta name="go-source" content="knative.dev/eventing-awssqs https://github.com/knative-sandbox/eventing-awssqs https://github.com/knative-sandbox/eventing-awssqs/tree/main{/dir} https://github.com/knative-sandbox/eventing-awssqs/blob/main{/dir}/{file}#L{line}">
</head></html>

View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/eventing-camel git https://github.com/knative-sandbox/eventing-camel">
<meta name="go-source" content="knative.dev/eventing-camel https://github.com/knative-sandbox/eventing-camel https://github.com/knative-sandbox/eventing-camel/tree/main{/dir} https://github.com/knative-sandbox/eventing-camel/blob/main{/dir}/{file}#L{line}">
</head></html>

View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/eventing-ceph git https://github.com/knative-sandbox/eventing-ceph">
<meta name="go-source" content="knative.dev/eventing-ceph https://github.com/knative-sandbox/eventing-ceph https://github.com/knative-sandbox/eventing-ceph/tree/main{/dir} https://github.com/knative-sandbox/eventing-ceph/blob/main{/dir}/{file}#L{line}">
</head></html>

View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/eventing-couchdb git https://github.com/knative-sandbox/eventing-couchdb">
<meta name="go-source" content="knative.dev/eventing-couchdb https://github.com/knative-sandbox/eventing-couchdb https://github.com/knative-sandbox/eventing-couchdb/tree/main{/dir} https://github.com/knative-sandbox/eventing-couchdb/blob/main{/dir}/{file}#L{line}">
</head></html>

View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/eventing-github git https://github.com/knative-sandbox/eventing-github">
<meta name="go-source" content="knative.dev/eventing-github https://github.com/knative-sandbox/eventing-github https://github.com/knative-sandbox/eventing-github/tree/main{/dir} https://github.com/knative-sandbox/eventing-github/blob/main{/dir}/{file}#L{line}">
</head></html>

View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/eventing-gitlab git https://github.com/knative-sandbox/eventing-gitlab">
<meta name="go-source" content="knative.dev/eventing-gitlab https://github.com/knative-sandbox/eventing-gitlab https://github.com/knative-sandbox/eventing-gitlab/tree/main{/dir} https://github.com/knative-sandbox/eventing-gitlab/blob/main{/dir}/{file}#L{line}">
</head></html>

View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/eventing-kafka-broker git https://github.com/knative-sandbox/eventing-kafka-broker">
<meta name="go-source" content="knative.dev/eventing-kafka-broker https://github.com/knative-sandbox/eventing-kafka-broker https://github.com/knative-sandbox/eventing-kafka-broker/tree/main{/dir} https://github.com/knative-sandbox/eventing-kafka-broker/blob/main{/dir}/{file}#L{line}">
</head></html>

View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/eventing-kafka git https://github.com/knative-sandbox/eventing-kafka">
<meta name="go-source" content="knative.dev/eventing-kafka https://github.com/knative-sandbox/eventing-kafka https://github.com/knative-sandbox/eventing-kafka/tree/main{/dir} https://github.com/knative-sandbox/eventing-kafka/blob/main{/dir}/{file}#L{line}">
</head></html>

View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/eventing-natss git https://github.com/knative-sandbox/eventing-natss">
<meta name="go-source" content="knative.dev/eventing-natss https://github.com/knative-sandbox/eventing-natss https://github.com/knative-sandbox/eventing-natss/tree/main{/dir} https://github.com/knative-sandbox/eventing-natss/blob/main{/dir}/{file}#L{line}">
</head></html>

View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/eventing-prometheus git https://github.com/knative-sandbox/eventing-prometheus">
<meta name="go-source" content="knative.dev/eventing-prometheus https://github.com/knative-sandbox/eventing-prometheus https://github.com/knative-sandbox/eventing-prometheus/tree/main{/dir} https://github.com/knative-sandbox/eventing-prometheus/blob/main{/dir}/{file}#L{line}">
</head></html>

View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/eventing-rabbitmq git https://github.com/knative-sandbox/eventing-rabbitmq">
<meta name="go-source" content="knative.dev/eventing-rabbitmq https://github.com/knative-sandbox/eventing-rabbitmq https://github.com/knative-sandbox/eventing-rabbitmq/tree/main{/dir} https://github.com/knative-sandbox/eventing-rabbitmq/blob/main{/dir}/{file}#L{line}">
</head></html>

View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/eventing-redis git https://github.com/knative-sandbox/eventing-redis">
<meta name="go-source" content="knative.dev/eventing-redis https://github.com/knative-sandbox/eventing-redis https://github.com/knative-sandbox/eventing-redis/tree/main{/dir} https://github.com/knative-sandbox/eventing-redis/blob/main{/dir}/{file}#L{line}">
</head></html>

4
golang/eventing.html Normal file
View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/eventing git https://github.com/knative/eventing">
<meta name="go-source" content="knative.dev/eventing https://github.com/knative/eventing https://github.com/knative/eventing/tree/main{/dir} https://github.com/knative/eventing/blob/main{/dir}/{file}#L{line}">
</head></html>

4
golang/hack.html Normal file
View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/hack git https://github.com/knative/hack">
<meta name="go-source" content="knative.dev/hack https://github.com/knative/hack https://github.com/knative/hack/tree/main{/dir} https://github.com/knative/hack/blob/main{/dir}/{file}#L{line}">
</head></html>

View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/homebrew-client git https://github.com/knative/homebrew-client">
<meta name="go-source" content="knative.dev/homebrew-client https://github.com/knative/homebrew-client https://github.com/knative/homebrew-client/tree/main{/dir} https://github.com/knative/homebrew-client/blob/main{/dir}/{file}#L{line}">
</head></html>

View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/homebrew-kn-plugins git https://github.com/knative-sandbox/homebrew-kn-plugins">
<meta name="go-source" content="knative.dev/homebrew-kn-plugins https://github.com/knative-sandbox/homebrew-kn-plugins https://github.com/knative-sandbox/homebrew-kn-plugins/tree/main{/dir} https://github.com/knative-sandbox/homebrew-kn-plugins/blob/main{/dir}/{file}#L{line}">
</head></html>

4
golang/integration.html Normal file
View File

@ -0,0 +1,4 @@
<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>

View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/kn-plugin-admin git https://github.com/knative-sandbox/kn-plugin-admin">
<meta name="go-source" content="knative.dev/kn-plugin-admin https://github.com/knative-sandbox/kn-plugin-admin https://github.com/knative-sandbox/kn-plugin-admin/tree/main{/dir} https://github.com/knative-sandbox/kn-plugin-admin/blob/main{/dir}/{file}#L{line}">
</head></html>

View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/kn-plugin-diag git https://github.com/knative-sandbox/kn-plugin-diag">
<meta name="go-source" content="knative.dev/kn-plugin-diag https://github.com/knative-sandbox/kn-plugin-diag https://github.com/knative-sandbox/kn-plugin-diag/tree/main{/dir} https://github.com/knative-sandbox/kn-plugin-diag/blob/main{/dir}/{file}#L{line}">
</head></html>

View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/kn-plugin-event git https://github.com/knative-sandbox/kn-plugin-event">
<meta name="go-source" content="knative.dev/kn-plugin-event https://github.com/knative-sandbox/kn-plugin-event https://github.com/knative-sandbox/kn-plugin-event/tree/main{/dir} https://github.com/knative-sandbox/kn-plugin-event/blob/main{/dir}/{file}#L{line}">
</head></html>

View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/kn-plugin-migration git https://github.com/knative-sandbox/kn-plugin-migration">
<meta name="go-source" content="knative.dev/kn-plugin-migration https://github.com/knative-sandbox/kn-plugin-migration https://github.com/knative-sandbox/kn-plugin-migration/tree/main{/dir} https://github.com/knative-sandbox/kn-plugin-migration/blob/main{/dir}/{file}#L{line}">
</head></html>

View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/kn-plugin-quickstart git https://github.com/knative-sandbox/kn-plugin-quickstart">
<meta name="go-source" content="knative.dev/kn-plugin-quickstart https://github.com/knative-sandbox/kn-plugin-quickstart https://github.com/knative-sandbox/kn-plugin-quickstart/tree/main{/dir} https://github.com/knative-sandbox/kn-plugin-quickstart/blob/main{/dir}/{file}#L{line}">
</head></html>

View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/kn-plugin-sample git https://github.com/knative-sandbox/kn-plugin-sample">
<meta name="go-source" content="knative.dev/kn-plugin-sample https://github.com/knative-sandbox/kn-plugin-sample https://github.com/knative-sandbox/kn-plugin-sample/tree/main{/dir} https://github.com/knative-sandbox/kn-plugin-sample/blob/main{/dir}/{file}#L{line}">
</head></html>

View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/kn-plugin-service-log git https://github.com/knative-sandbox/kn-plugin-service-log">
<meta name="go-source" content="knative.dev/kn-plugin-service-log https://github.com/knative-sandbox/kn-plugin-service-log https://github.com/knative-sandbox/kn-plugin-service-log/tree/main{/dir} https://github.com/knative-sandbox/kn-plugin-service-log/blob/main{/dir}/{file}#L{line}">
</head></html>

View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/kn-plugin-source-kafka git https://github.com/knative-sandbox/kn-plugin-source-kafka">
<meta name="go-source" content="knative.dev/kn-plugin-source-kafka https://github.com/knative-sandbox/kn-plugin-source-kafka https://github.com/knative-sandbox/kn-plugin-source-kafka/tree/main{/dir} https://github.com/knative-sandbox/kn-plugin-source-kafka/blob/main{/dir}/{file}#L{line}">
</head></html>

View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/kn-plugin-source-kamelet git https://github.com/knative-sandbox/kn-plugin-source-kamelet">
<meta name="go-source" content="knative.dev/kn-plugin-source-kamelet https://github.com/knative-sandbox/kn-plugin-source-kamelet https://github.com/knative-sandbox/kn-plugin-source-kamelet/tree/main{/dir} https://github.com/knative-sandbox/kn-plugin-source-kamelet/blob/main{/dir}/{file}#L{line}">
</head></html>

View File

@ -0,0 +1,4 @@
<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>

4
golang/knobots.html Normal file
View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/knobots git https://github.com/knative-sandbox/knobots">
<meta name="go-source" content="knative.dev/knobots https://github.com/knative-sandbox/knobots https://github.com/knative-sandbox/knobots/tree/main{/dir} https://github.com/knative-sandbox/knobots/blob/main{/dir}/{file}#L{line}">
</head></html>

4
golang/kperf.html Normal file
View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/kperf git https://github.com/knative-sandbox/kperf">
<meta name="go-source" content="knative.dev/kperf https://github.com/knative-sandbox/kperf https://github.com/knative-sandbox/kperf/tree/main{/dir} https://github.com/knative-sandbox/kperf/blob/main{/dir}/{file}#L{line}">
</head></html>

View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/net-certmanager git https://github.com/knative-sandbox/net-certmanager">
<meta name="go-source" content="knative.dev/net-certmanager https://github.com/knative-sandbox/net-certmanager https://github.com/knative-sandbox/net-certmanager/tree/main{/dir} https://github.com/knative-sandbox/net-certmanager/blob/main{/dir}/{file}#L{line}">
</head></html>

4
golang/net-contour.html Normal file
View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/net-contour git https://github.com/knative-sandbox/net-contour">
<meta name="go-source" content="knative.dev/net-contour https://github.com/knative-sandbox/net-contour https://github.com/knative-sandbox/net-contour/tree/main{/dir} https://github.com/knative-sandbox/net-contour/blob/main{/dir}/{file}#L{line}">
</head></html>

4
golang/net-http01.html Normal file
View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/net-http01 git https://github.com/knative-sandbox/net-http01">
<meta name="go-source" content="knative.dev/net-http01 https://github.com/knative-sandbox/net-http01 https://github.com/knative-sandbox/net-http01/tree/main{/dir} https://github.com/knative-sandbox/net-http01/blob/main{/dir}/{file}#L{line}">
</head></html>

View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/net-ingressv2 git https://github.com/knative-sandbox/net-ingressv2">
<meta name="go-source" content="knative.dev/net-ingressv2 https://github.com/knative-sandbox/net-ingressv2 https://github.com/knative-sandbox/net-ingressv2/tree/main{/dir} https://github.com/knative-sandbox/net-ingressv2/blob/main{/dir}/{file}#L{line}">
</head></html>

4
golang/net-istio.html Normal file
View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/net-istio git https://github.com/knative-sandbox/net-istio">
<meta name="go-source" content="knative.dev/net-istio https://github.com/knative-sandbox/net-istio https://github.com/knative-sandbox/net-istio/tree/main{/dir} https://github.com/knative-sandbox/net-istio/blob/main{/dir}/{file}#L{line}">
</head></html>

4
golang/net-kourier.html Normal file
View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/net-kourier git https://github.com/knative-sandbox/net-kourier">
<meta name="go-source" content="knative.dev/net-kourier https://github.com/knative-sandbox/net-kourier https://github.com/knative-sandbox/net-kourier/tree/main{/dir} https://github.com/knative-sandbox/net-kourier/blob/main{/dir}/{file}#L{line}">
</head></html>

4
golang/networking.html Normal file
View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/networking git https://github.com/knative/networking">
<meta name="go-source" content="knative.dev/networking https://github.com/knative/networking https://github.com/knative/networking/tree/main{/dir} https://github.com/knative/networking/blob/main{/dir}/{file}#L{line}">
</head></html>

4
golang/operator.html Normal file
View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/operator git https://github.com/knative/operator">
<meta name="go-source" content="knative.dev/operator https://github.com/knative/operator https://github.com/knative/operator/tree/main{/dir} https://github.com/knative/operator/blob/main{/dir}/{file}#L{line}">
</head></html>

4
golang/pkg.html Normal file
View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/pkg git https://github.com/knative/pkg">
<meta name="go-source" content="knative.dev/pkg https://github.com/knative/pkg https://github.com/knative/pkg/tree/main{/dir} https://github.com/knative/pkg/blob/main{/dir}/{file}#L{line}">
</head></html>

View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/reconciler-test git https://github.com/knative-sandbox/reconciler-test">
<meta name="go-source" content="knative.dev/reconciler-test https://github.com/knative-sandbox/reconciler-test https://github.com/knative-sandbox/reconciler-test/tree/main{/dir} https://github.com/knative-sandbox/reconciler-test/blob/main{/dir}/{file}#L{line}">
</head></html>

4
golang/release.html Normal file
View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/release git https://github.com/knative/release">
<meta name="go-source" content="knative.dev/release https://github.com/knative/release https://github.com/knative/release/tree/main{/dir} https://github.com/knative/release/blob/main{/dir}/{file}#L{line}">
</head></html>

View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/sample-controller git https://github.com/knative-sandbox/sample-controller">
<meta name="go-source" content="knative.dev/sample-controller https://github.com/knative-sandbox/sample-controller https://github.com/knative-sandbox/sample-controller/tree/main{/dir} https://github.com/knative-sandbox/sample-controller/blob/main{/dir}/{file}#L{line}">
</head></html>

View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/sample-source git https://github.com/knative-sandbox/sample-source">
<meta name="go-source" content="knative.dev/sample-source https://github.com/knative-sandbox/sample-source https://github.com/knative-sandbox/sample-source/tree/main{/dir} https://github.com/knative-sandbox/sample-source/blob/main{/dir}/{file}#L{line}">
</head></html>

4
golang/serving.html Normal file
View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/serving git https://github.com/knative/serving">
<meta name="go-source" content="knative.dev/serving https://github.com/knative/serving https://github.com/knative/serving/tree/main{/dir} https://github.com/knative/serving/blob/main{/dir}/{file}#L{line}">
</head></html>

4
golang/specs.html Normal file
View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/specs git https://github.com/knative/specs">
<meta name="go-source" content="knative.dev/specs https://github.com/knative/specs https://github.com/knative/specs/tree/main{/dir} https://github.com/knative/specs/blob/main{/dir}/{file}#L{line}">
</head></html>

4
golang/test-infra.html Normal file
View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/test-infra git https://github.com/knative/test-infra">
<meta name="go-source" content="knative.dev/test-infra https://github.com/knative/test-infra https://github.com/knative/test-infra/tree/main{/dir} https://github.com/knative/test-infra/blob/main{/dir}/{file}#L{line}">
</head></html>

4
golang/ux.html Normal file
View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/ux git https://github.com/knative/ux">
<meta name="go-source" content="knative.dev/ux https://github.com/knative/ux https://github.com/knative/ux/tree/main{/dir} https://github.com/knative/ux/blob/main{/dir}/{file}#L{line}">
</head></html>

4
golang/website.html Normal file
View File

@ -0,0 +1,4 @@
<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>

View File

@ -0,0 +1,4 @@
<html><head>
<meta name="go-import" content="knative.dev/wg-repository git https://github.com/knative-sandbox/wg-repository">
<meta name="go-source" content="knative.dev/wg-repository https://github.com/knative-sandbox/wg-repository https://github.com/knative-sandbox/wg-repository/tree/main{/dir} https://github.com/knative-sandbox/wg-repository/blob/main{/dir}/{file}#L{line}">
</head></html>

View File

@ -116,6 +116,11 @@ if [ -z "$SKIP_BLOG" ]; then
for d in blog community css scss webfonts images js; do
mv temp/website/public/$d site/
done
# Copy go mod files so knative.dev/blahblah vanity URLs work
mkdir site/golang
cp golang/*.html site/golang/
cat golang/_redirects >> site/_redirects
fi
# Home page is served from docs, so add a redirect.

5
tools/redir-gen/go.mod Normal file
View File

@ -0,0 +1,5 @@
module knative.dev/website/tools/redir-gen
go 1.15
require github.com/google/go-github/v32 v32.1.0

13
tools/redir-gen/go.sum Normal file
View File

@ -0,0 +1,13 @@
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY=
github.com/google/go-github/v32 v32.1.0 h1:GWkQOdXqviCPx7Q7Fj+KyPoGm4SwHRh8rheoPhd27II=
github.com/google/go-github/v32 v32.1.0/go.mod h1:rIEpZD9CTDQwDK9GDrtMTycQNA4JU3qBsCizh3q2WCI=
github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=

184
tools/redir-gen/main.go Normal file
View File

@ -0,0 +1,184 @@
/*
Copyright 2020 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package main
import (
"context"
"fmt"
"html/template"
"io/ioutil"
"log"
"os"
"regexp"
"sort"
"strings"
"github.com/google/go-github/v32/github"
)
var (
knativeOrgs = []string{"knative", "knative-sandbox"}
allowedRepoRe = regexp.MustCompile("^[a-z][-a-z0-9]+$")
)
// repoInfo provides a simple holder for GitHub repo information needed to
// generate go mod redirects.
type repoInfo struct {
// Org is the name of the github organization the repo is in.
Org string
// Repo is the name of the github repo within the organizatiøon (e.g.
// "serving", NOT "knative/serving")
Repo string
// DefaultBranch is the name of the default branch. This will be changing
// from "master" to "main" over time.
DefaultBranch string
}
type riSlice []repoInfo
func main() {
repos, err := fetchRepos(knativeOrgs)
if err != nil {
log.Fatal("Failed to fetch repos: ", err)
}
for _, repo := range repos {
if err := createGoGetFile(repo); err != nil {
log.Fatalf("Unable to create go mod file for %s: %v", repo, err)
}
}
if err := appendRedirs(repos); err != nil {
log.Fatal("Failed to write redir file: ", err)
}
}
func fetchRepos(orgs []string) ([]repoInfo, error) {
ctx := context.Background()
allRepos := riSlice{}
client := github.NewClient(nil)
for _, org := range orgs {
opts := &github.RepositoryListByOrgOptions{
ListOptions: github.ListOptions{PerPage: 50},
}
for {
repos, resp, err := client.Repositories.ListByOrg(ctx, org, opts)
if err != nil {
return nil, err
}
for _, r := range repos {
if !allowedRepoRe.MatchString(*r.Name) {
log.Printf("Ignoring repo %s, matched by ignore %q", *r.Name, allowedRepoRe)
continue
}
if *r.Archived {
log.Print("Ignoring archived repo: ", *r.Name)
continue
}
allRepos = append(allRepos, repoInfo{org, *r.Name, *r.DefaultBranch})
}
if resp.NextPage == 0 {
break
}
}
}
sort.Sort(allRepos)
return allRepos, nil
}
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}">
</head></html>
`
redirText = `/{{.Repo}}/* go-get=1 /golang/{{.Repo}}.html 200
`
autogenPrefix = `
# This file is AUTO-GENERATED
#
# DO NOT EDIT!
#
# To regenerate, run:
`
)
func appendRedirs(ris []repoInfo) error {
redirFilename := "golang/_redirects"
redirFile, err := os.OpenFile(redirFilename, os.O_RDWR|os.O_CREATE, 0755)
if err != nil {
return fmt.Errorf("unable to open %q: %w", redirFilename, err)
}
defer redirFile.Close()
redirs, err := ioutil.ReadAll(redirFile)
if err != nil {
return fmt.Errorf("unable to read %q: %w", redirFilename, err)
}
seekTo := int64(strings.Index(string(redirs), autogenPrefix))
if seekTo == -1 {
seekTo = int64(len(redirs))
}
if _, err := redirFile.Seek(seekTo, 0); err != nil {
return fmt.Errorf("unable to seek in %q: %w", redirFilename, err)
}
if redirFile.Truncate(seekTo) != nil {
return fmt.Errorf("unable to truncate %q: %w", redirFilename, err)
}
if _, err := redirFile.WriteString(autogenPrefix); err != nil {
return fmt.Errorf("unable to write to %q: %w", redirFilename, err)
}
if _, err := redirFile.WriteString(fmt.Sprintf("# %s\n", strings.Join(os.Args, " "))); err != nil {
return fmt.Errorf("unable to write to %q: %w", redirFilename, err)
}
for _, ri := range ris {
if redirTemplate.Execute(redirFile, ri) != nil {
return fmt.Errorf("unable to write %s to %q: %w", ri.Repo, redirFilename, err)
}
}
return nil
}
var fileTemplate = template.Must(template.New("gohtml").Parse(goHTML))
var redirTemplate = template.Must(template.New("redir").Parse(redirText))
// createGoGetFile creates a static HTML file providing a knative.dev mapping
// for the specified org and repo.
func createGoGetFile(ri repoInfo) error {
filename := fmt.Sprintf("golang/%s.html", ri.Repo)
file, err := os.Create(filename)
if err != nil {
return err
}
defer file.Close()
return fileTemplate.Execute(file, ri)
}
func (ri repoInfo) String() string {
return ri.Org + "/" + ri.Repo
}
func (ris riSlice) Len() int {
return len(ris)
}
func (ris riSlice) Less(i, j int) bool {
return ris[i].Repo < ris[j].Repo
}
func (ris riSlice) Swap(i, j int) {
ris[i], ris[j] = ris[j], ris[i]
}

View File

@ -0,0 +1,4 @@
<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/master{/dir} https://github.com/{{.Org}}/{{.Repo}}/blob/master{/dir}/{file}#L{line}">
</head></html>