Skip to content

Commit

Permalink
add launchpad.net/gocheck mirror, relax spec validation
Browse files Browse the repository at this point in the history
  • Loading branch information
dmgk committed May 3, 2020
1 parent 31b5c61 commit a55976d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 30 deletions.
1 change: 1 addition & 0 deletions tuple/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
6 changes: 1 addition & 5 deletions tuple/tuple.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]) {
Expand Down
25 changes: 0 additions & 25 deletions tuple/tuple_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},

Expand Down Expand Up @@ -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())
}
}
}

0 comments on commit a55976d

Please sign in to comment.