mirror of https://github.com/goproxyio/goproxy
fix(test): 1. solve testdata error 2. update shell to run test
parent
4cc5c7e7b7
commit
b0865d643c
|
@ -1,10 +1,9 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
go env
|
|
||||||
|
|
||||||
export GO111MODULE=on
|
export GO111MODULE=on
|
||||||
|
|
||||||
go generate
|
go generate
|
||||||
go mod tidy
|
go mod tidy
|
||||||
|
go test -v `(go list ./... | grep "pkg/proxy")`
|
||||||
# build
|
# build
|
||||||
go build -o bin/goproxy
|
go build -o bin/goproxy
|
|
@ -10,6 +10,7 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/goproxyio/goproxy/pkg/cfg"
|
||||||
"github.com/goproxyio/goproxy/pkg/modfetch"
|
"github.com/goproxyio/goproxy/pkg/modfetch"
|
||||||
"github.com/goproxyio/goproxy/pkg/modfetch/codehost"
|
"github.com/goproxyio/goproxy/pkg/modfetch/codehost"
|
||||||
"github.com/goproxyio/goproxy/pkg/module"
|
"github.com/goproxyio/goproxy/pkg/module"
|
||||||
|
@ -23,9 +24,15 @@ type modInfo struct {
|
||||||
suf string
|
suf string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewProxy(cache string) http.Handler {
|
func setupEnv(basedir string) {
|
||||||
modfetch.PkgMod = filepath.Join(cache, "pkg", "mod")
|
modfetch.QuietLookup = true // just to hide modfetch/cache.go#127
|
||||||
|
modfetch.PkgMod = filepath.Join(basedir, "pkg", "mod")
|
||||||
codehost.WorkRoot = filepath.Join(modfetch.PkgMod, "cache", "vcs")
|
codehost.WorkRoot = filepath.Join(modfetch.PkgMod, "cache", "vcs")
|
||||||
|
cfg.CmdName = "mod download" // just to hide modfetch/fetch.go#L87
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewProxy(cache string) http.Handler {
|
||||||
|
setupEnv(cache)
|
||||||
|
|
||||||
cacheDir = filepath.Join(modfetch.PkgMod, "cache", "download")
|
cacheDir = filepath.Join(modfetch.PkgMod, "cache", "download")
|
||||||
innerHandle = http.FileServer(http.Dir(cacheDir))
|
innerHandle = http.FileServer(http.Dir(cacheDir))
|
||||||
|
|
|
@ -76,7 +76,7 @@ var _modInfoTests = []struct {
|
||||||
path: "github.com/PuerkitoBio/goquery",
|
path: "github.com/PuerkitoBio/goquery",
|
||||||
version: "v0.0.0-20181014175806-2af3d16e2bb8",
|
version: "v0.0.0-20181014175806-2af3d16e2bb8",
|
||||||
time: time.Date(2018, 10, 14, 17, 58, 6, 0, time.UTC),
|
time: time.Date(2018, 10, 14, 17, 58, 6, 0, time.UTC),
|
||||||
gomod: `module github.com/PuerkitoBio/goquery\n`,
|
gomod: "module github.com/PuerkitoBio/goquery\n",
|
||||||
zip: []string{
|
zip: []string{
|
||||||
".gitattributes",
|
".gitattributes",
|
||||||
".gitignore",
|
".gitignore",
|
||||||
|
|
Loading…
Reference in New Issue