diff options
| author | Grégoire Duchêne <gduchene@awhk.org> | 2021-02-19 16:30:14 +0000 |
|---|---|---|
| committer | Grégoire Duchêne <gduchene@awhk.org> | 2021-02-19 16:30:14 +0000 |
| commit | 956792dc5cd92612584d95a1a791460cecd8ed19 (patch) | |
| tree | 93377bf9fa18d796944297944d2f2463262d8e61 | |
| parent | 596e8f8cf4a328417d94c972a8c9e6e9d93ae44b (diff) | |
Use URL.Query.Getv0.1.0
| -rw-r--r-- | cmd/go-import-redirect/main.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/cmd/go-import-redirect/main.go b/cmd/go-import-redirect/main.go index c4079cf..ea994b2 100644 --- a/cmd/go-import-redirect/main.go +++ b/cmd/go-import-redirect/main.go @@ -32,7 +32,7 @@ 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 v, ok := req.URL.Query()["go-get"]; ok && len(v) > 0 && v[0] == "1" { + if req.URL.Query().Get("go-get") == "1" { resp.WriteHeader(http.StatusOK) } else { resp.Header().Set("Location", "https://pkg.go.dev/"+pkg) |
