From a55976d6bf6ca92063079614b5d756fe78f09c36 Mon Sep 17 00:00:00 2001 From: Dmitri Goutnik Date: Sun, 3 May 2020 07:44:38 -0500 Subject: [PATCH] add launchpad.net/gocheck mirror, relax spec validation --- tuple/resolver.go | 1 + tuple/tuple.go | 6 +----- tuple/tuple_test.go | 25 ------------------------- 3 files changed, 2 insertions(+), 30 deletions(-) diff --git a/tuple/resolver.go b/tuple/resolver.go index bb001c7..3329231 100644 --- a/tuple/resolver.go +++ b/tuple/resolver.go @@ -112,6 +112,7 @@ var resolvers = map[string]resolver{ "honnef.co/go/tools": &mirror{GH, "dominikh", "go-tools", ""}, "howett.net/plist": &mirror{GitlabSource("https://gitlab.howett.net"), "go", "plist", ""}, "k8s.io": mirrorFn(k8sIoResolver), + "launchpad.net/gocheck": &mirror{GH, "go-check", "check", ""}, "layeh.com/radius": &mirror{GH, "layeh", "radius", ""}, "mvdan.cc": mirrorFn(mvdanCcResolver), "rsc.io": mirrorFn(rscIoResolver), diff --git a/tuple/tuple.go b/tuple/tuple.go index 2843fa3..6ebb13c 100644 --- a/tuple/tuple.go +++ b/tuple/tuple.go @@ -70,11 +70,7 @@ func parseSpec(spec string) (string, string, error) { switch len(parts) { case 1: - // must be a versionless local filesystem "replace" spec rhs - if isFilesystemPath(parts[0]) { - return parts[0], "", nil - } - return "", "", fmt.Errorf("unexpected spec format: %q", spec) + return parts[0], "", nil case 2: // regular spec if tagRx.MatchString(parts[1]) { diff --git a/tuple/tuple_test.go b/tuple/tuple_test.go index db88b4c..9420435 100644 --- a/tuple/tuple_test.go +++ b/tuple/tuple_test.go @@ -53,9 +53,6 @@ func TestParseRegularSpecFail(t *testing.T) { examples := [][]string{ // spec, expected error - // missing version - {"github.com/pkg/errors", "unexpected spec format"}, - // extra stuff {"github.com/pkg/errors v1.0.0 v2.0.0", "unexpected number of fields"}, @@ -114,25 +111,3 @@ func TestPackageReplace(t *testing.T) { } } } - -func TestPackageReplaceFail(t *testing.T) { - examples := [][]string{ - // spec, expected error - - // // missing version in the left spec - // {"github.com/hashicorp/consul/api => ./api", "unexpected spec format"}, - - // missing version in the right spec - {"github.com/spf13/cobra v0.0.0-20180412120829-615425954c3b => github.com/rsteube/cobra", "unexpected spec format"}, - } - - for i, x := range examples { - _, err := Parse(x[0]) - if err == nil { - t.Fatal("expected err to not be nil") - } - if !strings.HasPrefix(err.Error(), x[1]) { - t.Errorf("(%d) expected err to start with %q, got %q", i, x[1], err.Error()) - } - } -}