Merge pull request #25207 from hashicorp/alisdair/remove-dead-code-source-addr-helpers
configs/configload: Remove unused SourceAddr funcs
This commit is contained in:
commit
06344e4540
|
@ -151,3 +151,18 @@ func (g reusingGetter) getWithGoGetter(instPath, addr string) (string, error) {
|
||||||
// the requested object!
|
// the requested object!
|
||||||
return filepath.Clean(finalDir), nil
|
return filepath.Clean(finalDir), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// splitAddrSubdir splits the given address (which is assumed to be a
|
||||||
|
// registry address or go-getter-style address) into a package portion
|
||||||
|
// and a sub-directory portion.
|
||||||
|
//
|
||||||
|
// The package portion defines what should be downloaded and then the
|
||||||
|
// sub-directory portion, if present, specifies a sub-directory within
|
||||||
|
// the downloaded object (an archive, VCS repository, etc) that contains
|
||||||
|
// the module's configuration files.
|
||||||
|
//
|
||||||
|
// The subDir portion will be returned as empty if no subdir separator
|
||||||
|
// ("//") is present in the address.
|
||||||
|
func splitAddrSubdir(addr string) (packageAddr, subDir string) {
|
||||||
|
return getter.SourceDirSubdir(addr)
|
||||||
|
}
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
package configload
|
|
||||||
|
|
||||||
import (
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/hashicorp/go-getter"
|
|
||||||
|
|
||||||
"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
|
|
||||||
}
|
|
||||||
|
|
||||||
// splitAddrSubdir splits the given address (which is assumed to be a
|
|
||||||
// registry address or go-getter-style address) into a package portion
|
|
||||||
// and a sub-directory portion.
|
|
||||||
//
|
|
||||||
// The package portion defines what should be downloaded and then the
|
|
||||||
// sub-directory portion, if present, specifies a sub-directory within
|
|
||||||
// the downloaded object (an archive, VCS repository, etc) that contains
|
|
||||||
// the module's configuration files.
|
|
||||||
//
|
|
||||||
// The subDir portion will be returned as empty if no subdir separator
|
|
||||||
// ("//") is present in the address.
|
|
||||||
func splitAddrSubdir(addr string) (packageAddr, subDir string) {
|
|
||||||
return getter.SourceDirSubdir(addr)
|
|
||||||
}
|
|
Loading…
Reference in New Issue