aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/main.go b/main.go
index 0c361b1..4d8e0b6 100644
--- a/main.go
+++ b/main.go
@@ -29,13 +29,13 @@ func redirect(resp http.ResponseWriter, req *http.Request) {
}
pkg := path.Join(req.Host, req.URL.Path)
- resp.Header().Set("Content-Type", "text/html; charset=utf-8")
- if req.URL.Query().Get("go-get") == "1" {
- resp.WriteHeader(http.StatusOK)
- } else {
+ if req.URL.Query().Get("go-get") != "1" {
resp.Header().Set("Location", "https://pkg.go.dev/"+pkg)
resp.WriteHeader(http.StatusFound)
+ return
}
+ resp.Header().Set("Content-Type", "text/html; charset=utf-8")
+ resp.WriteHeader(http.StatusOK)
if _, err := fmt.Fprint(resp, GetBody(pkg)); err != nil {
log.Println("fmt.Fprint:", err)
}