mirror of https://github.com/goproxyio/goproxy
fix latest fetch
parent
18c8979b4c
commit
3ba85be18d
|
@ -2,15 +2,16 @@ package proxy
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/goproxyio/goproxy/pkg/modfetch"
|
|
||||||
"github.com/goproxyio/goproxy/pkg/modfetch/codehost"
|
|
||||||
"github.com/goproxyio/goproxy/pkg/module"
|
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/goproxyio/goproxy/pkg/modfetch"
|
||||||
|
"github.com/goproxyio/goproxy/pkg/modfetch/codehost"
|
||||||
|
"github.com/goproxyio/goproxy/pkg/module"
|
||||||
)
|
)
|
||||||
|
|
||||||
var cacheDir string
|
var cacheDir string
|
||||||
|
@ -61,7 +62,17 @@ func NewProxy(cache string) http.Handler {
|
||||||
ReturnServerError(w, err)
|
ReturnServerError(w, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if err := downloadMod(modPath, "latest"); err != nil {
|
repo, err := modfetch.Lookup(modPath)
|
||||||
|
if err != nil {
|
||||||
|
errLogger.Printf("lookup failed: %v", err)
|
||||||
|
ReturnServerError(w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
rev, err := repo.Stat("latest")
|
||||||
|
if err != nil {
|
||||||
|
errLogger.Printf("latest failed: %v", err)
|
||||||
|
}
|
||||||
|
if err := downloadMod(modPath, rev.Version); err != nil {
|
||||||
errLogger.Printf("download get err %s", err)
|
errLogger.Printf("download get err %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue