Skip to content

Commit

Permalink
fix gotest.tools resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
dmgk committed May 3, 2020
1 parent a55976d commit 0087562
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
15 changes: 14 additions & 1 deletion tuple/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ var resolvers = map[string]resolver{
"google.golang.org/genproto": &mirror{GH, "google", "go-genproto", ""},
"google.golang.org/grpc": &mirror{GH, "grpc", "grpc-go", ""},
"gopkg.in": mirrorFn(gopkgInResolver),
"gotest.tools": &mirror{GH, "gotestyourself", "gotest.tools", ""},
"gotest.tools": mirrorFn(gotestToolsResolver),
"honnef.co/go/tools": &mirror{GH, "dominikh", "go-tools", ""},
"howett.net/plist": &mirror{GitlabSource("https://gitlab.howett.net"), "go", "plist", ""},
"k8s.io": mirrorFn(k8sIoResolver),
Expand Down Expand Up @@ -333,3 +333,16 @@ func rscIoResolver(pkg string) (*mirror, error) {
}
return &mirror{GH, "rsc", sm[0][1], ""}, nil
}

func gotestToolsResolver(pkg string) (*mirror, error) {
if !strings.HasPrefix(pkg, "gotest.tools") {
return nil, nil
}
switch pkg {
case "gotest.tools":
return &mirror{GH, "gotestyourself", "gotest.tools", ""}, nil
case "gotest.tools/gotestsum":
return &mirror{GH, "gotestyourself", "gotestsum", ""}, nil
}
return nil, nil
}
11 changes: 10 additions & 1 deletion tuple/resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,19 @@ func TestMvdanCcResolver(t *testing.T) {
testResolverFnExamples(t, "mvdanCcResolver", mvdanCcResolver, examples)
}

func TesteRscIoResolver(t *testing.T) {
func TestRscIoResolver(t *testing.T) {
examples := []resolverExample{
// name, expected account, expected project
{"rsc.io/pdf", GH, "rsc", "pdf", ""},
}
testResolverFnExamples(t, "rscIoResolver", rscIoResolver, examples)
}

func TestGotestToolsResolver(t *testing.T) {
examples := []resolverExample{
// name, expected account, expected project
{"gotest.tools", GH, "gotestyourself", "gotest.tools", ""},
{"gotest.tools/gotestsum", GH, "gotestyourself", "gotestsum", ""},
}
testResolverFnExamples(t, "gotestToolsResolver", gotestToolsResolver, examples)
}

0 comments on commit 0087562

Please sign in to comment.