mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-09-06 09:06:44 +00:00
![Paddy](/assets/img/avatar_default.png)
Switch to using Go modules. This migrates our vendor.json to use Go 1.11's modules system, and replaces the vendor folder with the output of go mod vendor. The vendored code should remain basically the same; I believe some tree shaking of packages and support scripts/licenses/READMEs/etc. happened. This also fixes Travis and our Makefile to no longer use govendor.
27 lines
573 B
Go
27 lines
573 B
Go
package getter
|
|
|
|
// GitDetector implements Detector to detect Git SSH URLs such as
|
|
// git@host.com:dir1/dir2 and converts them to proper URLs.
|
|
type GitDetector struct{}
|
|
|
|
func (d *GitDetector) Detect(src, _ string) (string, bool, error) {
|
|
if len(src) == 0 {
|
|
return "", false, nil
|
|
}
|
|
|
|
u, err := detectSSH(src)
|
|
if err != nil {
|
|
return "", true, err
|
|
}
|
|
if u == nil {
|
|
return "", false, nil
|
|
}
|
|
|
|
// We require the username to be "git" to assume that this is a Git URL
|
|
if u.User.Username() != "git" {
|
|
return "", false, nil
|
|
}
|
|
|
|
return "git::" + u.String(), true, nil
|
|
}
|