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>
This commit is contained in:
parent
ecb536e190
commit
d7eadc78dc
3 changed files with 92 additions and 0 deletions
19
urlutil/url.go
Normal file
19
urlutil/url.go
Normal file
|
@ -0,0 +1,19 @@
|
|||
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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue