aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorGrégoire Duchêne <gduchene@awhk.org>2021-02-19 14:43:56 +0000
committerGrégoire Duchêne <gduchene@awhk.org>2021-02-19 14:56:40 +0000
commit5d8da7f0edb5760ed68dd2830089c86ea823ca00 (patch)
tree4c356f8549bbe89f2b8023e95a95693df668fac3 /cmd
parent4b1f1a4ab46f29aa19b642b981e91da096a372ef (diff)
Redirect to pkg.go.dev instead of godoc.org
See https://blog.golang.org/pkg.go.dev-2020, godoc.org is being replaced by pkg.go.dev.
Diffstat (limited to 'cmd')
-rw-r--r--cmd/go-import-redirect/main.go2
-rw-r--r--cmd/go-import-redirect/main_aws.go3
2 files changed, 3 insertions, 2 deletions
diff --git a/cmd/go-import-redirect/main.go b/cmd/go-import-redirect/main.go
index f573bc8..6ddfc19 100644
--- a/cmd/go-import-redirect/main.go
+++ b/cmd/go-import-redirect/main.go
@@ -34,7 +34,7 @@ func redirect(resp http.ResponseWriter, req *http.Request) {
if v, ok := req.URL.Query()["go-get"]; ok && len(v) > 0 && v[0] == "1" {
resp.WriteHeader(http.StatusOK)
} else {
- resp.Header()["Location"] = []string{"https://godoc.org/" + pkg}
+ resp.Header()["Location"] = []string{"https://pkg.go.dev/" + pkg}
resp.WriteHeader(http.StatusFound)
}
resp.Write([]byte(internal.GetBody(pkg)))
diff --git a/cmd/go-import-redirect/main_aws.go b/cmd/go-import-redirect/main_aws.go
index f6a95b1..4d4b0e7 100644
--- a/cmd/go-import-redirect/main_aws.go
+++ b/cmd/go-import-redirect/main_aws.go
@@ -14,6 +14,7 @@ import (
"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
+
"go.awhk.org/go-import-redirect/internal"
)
@@ -28,7 +29,7 @@ func redirect(ctx context.Context, req events.APIGatewayProxyRequest) (events.AP
if v, ok := req.QueryStringParameters["go-get"]; ok && v == "1" {
resp.StatusCode = http.StatusOK
} else {
- resp.Headers["Location"] = "https://godoc.org/" + pkg
+ resp.Headers["Location"] = "https://pkg.go.dev/" + pkg
resp.StatusCode = http.StatusFound
}
return resp, nil