@@ -76,20 +76,24 @@ func (Project) repoFromGopathAndWd(gopath string, getwd func() (string, error))
76
76
if len (gopath ) == 0 {
77
77
gopath = build .Default .GOPATH
78
78
}
79
- goSrc := filepath .Join (gopath , "src" )
80
79
81
- // Make sure the GOPATH is set and the working dir is under the GOPATH
82
- if ! strings . HasPrefix ( filepath .Dir ( wd ), goSrc ) {
83
- return "" , fmt . Errorf ( "working directory must be a project directory under " +
84
- "$GOPATH/src/<project-package> \n - GOPATH=%s \n - WD=%s" , gopath , wd )
85
- }
80
+ for _ , workspace := range filepath . SplitList ( gopath ) {
81
+ goSrc := filepath .Join ( workspace , "src" )
82
+
83
+ // Make sure the GOPATH is set and the working dir is under the GOPATH
84
+ if strings . HasPrefix ( filepath . Dir ( wd ), goSrc ) {
86
85
87
- // Figure out the repo name by removing $GOPATH/src from the working directory - e.g.
88
- // '$GOPATH/src/kubernetes-sigs/controller-tools' becomes 'kubernetes-sigs/controller-tools'
89
- repo := ""
90
- for wd != goSrc {
91
- repo = filepath .Join (filepath .Base (wd ), repo )
92
- wd = filepath .Dir (wd )
86
+ // Figure out the repo name by removing $GOPATH/src from the working directory - e.g.
87
+ // '$GOPATH/src/kubernetes-sigs/controller-tools' becomes 'kubernetes-sigs/controller-tools'
88
+ repo := ""
89
+ for wd != goSrc {
90
+ repo = filepath .Join (filepath .Base (wd ), repo )
91
+ wd = filepath .Dir (wd )
92
+ }
93
+ return repo , nil
94
+ }
93
95
}
94
- return repo , nil
96
+
97
+ return "" , fmt .Errorf ("working directory must be a project directory under " +
98
+ "$GOPATH/src/<project-package>\n - GOPATH=%s\n - WD=%s" , gopath , wd )
95
99
}
0 commit comments