Use glob matching for package paths (#1409)

- Match the behavior of GOPRIVATE/GONOPROXY/GONOSUMDB
This commit is contained in:
Rob Prentiss
2019-10-02 05:45:58 -07:00
committed by Marwan Sulaiman
parent 90b3c1dc97
commit ed66d85f3f
5 changed files with 160 additions and 31 deletions
+22
View File
@@ -36,6 +36,28 @@ var testCases = []struct {
input: "github.com/gomods/athens",
expectedMode: None,
},
{
name: "multiple depth pattern match",
file: &DownloadFile{
Mode: Sync,
Paths: []*DownloadPath{
{Pattern: "github.com/*", Mode: None},
},
},
input: "github.com/gomods/athens/pkg/mode",
expectedMode: None,
},
{
name: "subdomain pattern match",
file: &DownloadFile{
Mode: Sync,
Paths: []*DownloadPath{
{Pattern: "*.github.com/gomods/*", Mode: None},
},
},
input: "athens.github.com/gomods/pkg/mode",
expectedMode: None,
},
{
name: "pattern fallback",
file: &DownloadFile{