mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-04 13:17:43 -06:00
29 lines
441 B
Go
29 lines
441 B
Go
|
package configload
|
||
|
|
||
|
import (
|
||
|
"strings"
|
||
|
|
||
|
"github.com/hashicorp/terraform/registry/regsrc"
|
||
|
)
|
||
|
|
||
|
var localSourcePrefixes = []string{
|
||
|
"./",
|
||
|
"../",
|
||
|
".\\",
|
||
|
"..\\",
|
||
|
}
|
||
|
|
||
|
func isLocalSourceAddr(addr string) bool {
|
||
|
for _, prefix := range localSourcePrefixes {
|
||
|
if strings.HasPrefix(addr, prefix) {
|
||
|
return true
|
||
|
}
|
||
|
}
|
||
|
return false
|
||
|
}
|
||
|
|
||
|
func isRegistrySourceAddr(addr string) bool {
|
||
|
_, err := regsrc.ParseModuleSource(addr)
|
||
|
return err == nil
|
||
|
}
|