more functionality
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
@@ -18,6 +17,7 @@ type Queryer struct {
|
||||
Root string
|
||||
Client http.Client
|
||||
Cache cache.Cache
|
||||
Logger logger
|
||||
}
|
||||
|
||||
type majorVersion struct {
|
||||
@@ -59,17 +59,17 @@ func (q *Queryer) findLatestMajorVersion(module string) string {
|
||||
}
|
||||
|
||||
func (q *Queryer) makeProxyRequest(mod string) libyear.Info {
|
||||
log.Printf("makeProxyRequest for https://proxy.golang.org/%s", mod)
|
||||
if q.Root == "" {
|
||||
q.Root = "https://proxy.golang.org/"
|
||||
}
|
||||
q.Logger.Debugf("makeProxyRequest for %s/%s\n", q.Root, mod)
|
||||
|
||||
u, _ := url.Parse(q.Root)
|
||||
u.Path = mod
|
||||
|
||||
i := q.Cache.Get(u.String())
|
||||
if i.Version != "" {
|
||||
log.Printf("cache hit for https://proxy.golang.org/%s", mod)
|
||||
q.Logger.Debugf("cache hit for https://proxy.golang.org/%s\n", mod)
|
||||
return i
|
||||
}
|
||||
req, err := http.NewRequest("GET", u.String(), nil)
|
||||
|
Reference in New Issue
Block a user