File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -469,6 +469,11 @@ func (d *Dependency) Remote() string {
469469 r = d .Repository
470470 } else {
471471 r = "https://" + d .Name
472+ repo , err := vcs .NewRepo ("https://" + d .Name , "" )
473+ // TODO: change the function signature and return the error (?)
474+ if err == nil {
475+ r = repo .Remote ()
476+ }
472477 }
473478
474479 f , nr , _ := mirrors .Get (r )
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ import:
3636 - package: github.com/Masterminds/structable
3737 - package: github.com/Masterminds/cookoo/color
3838 - package: github.com/Masterminds/cookoo/convert
39+ - package: golang.org/x/crypto
3940
4041testImport:
4142 - package: github.com/kylelemons/go-gypsy
@@ -176,3 +177,21 @@ func TestOwners(t *testing.T) {
176177 t .Error ("Unable to parse owners from yaml" )
177178 }
178179}
180+
181+ func TestRemote (t * testing.T ) {
182+ tests := []struct {
183+ name string
184+ remote string
185+ }{
186+ {"golang.org/x/crypto" , "https://go.googlesource.com/crypto" },
187+ {"gopkg.in/yaml.v2" , "https://gopkg.in/yaml.v2" },
188+ {"github.com/Masterminds/glide" , "https://github.com/Masterminds/glide" },
189+ }
190+ for _ , tt := range tests {
191+ d := Dependency {Name : tt .name }
192+ r := d .Remote ()
193+ if r != tt .remote {
194+ t .Errorf ("Bad remote - want %s, got %s" , tt .remote , r )
195+ }
196+ }
197+ }
You can’t perform that action at this time.
0 commit comments