pkg/urlutil/url.go
Michael Crosby d7eadc78dc Move git and url checks into pkg
This moves the IsGIT and IsURL functions out of the generic `utils`
package and into their own `urlutil` pkg.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2014-11-24 18:10:37 -05:00

19 lines
360 B
Go

package urlutil
import "strings"
var validUrlPrefixes = []string{
"http://",
"https://",
}
// IsURL returns true if the provided str is a valid URL by doing
// a simple change for the transport of the url.
func IsURL(str string) bool {
for _, prefix := range validUrlPrefixes {
if strings.HasPrefix(str, prefix) {
return true
}
}
return false
}