mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-25 08:21:07 -06:00
59939cf320
Unlike the old installer in config/module, this uses new-style installation directories that include the static module path so that paths we show in diagnostics will be more meaningful to the user. As before, we retrieve the entire "package" associated with the given source string, rather than any given subdirectory directly, because the retrieved module may contain ../ references into parent directories which must be resolvable after extraction.
24 lines
561 B
Go
24 lines
561 B
Go
package registry
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/hashicorp/terraform/registry/regsrc"
|
|
)
|
|
|
|
type errModuleNotFound struct {
|
|
addr *regsrc.Module
|
|
}
|
|
|
|
func (e *errModuleNotFound) Error() string {
|
|
return fmt.Sprintf("module %s not found", e.addr)
|
|
}
|
|
|
|
// IsModuleNotFound returns true only if the given error is a "module not found"
|
|
// error. This allows callers to recognize this particular error condition
|
|
// as distinct from operational errors such as poor network connectivity.
|
|
func IsModuleNotFound(err error) bool {
|
|
_, ok := err.(*errModuleNotFound)
|
|
return ok
|
|
}
|