diff --git a/tuple/resolver.go b/tuple/resolver.go index 3329231..224e472 100644 --- a/tuple/resolver.go +++ b/tuple/resolver.go @@ -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), @@ -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 +} diff --git a/tuple/resolver_test.go b/tuple/resolver_test.go index 33d0d7d..66cd539 100644 --- a/tuple/resolver_test.go +++ b/tuple/resolver_test.go @@ -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) +}