internal/getproviders: Exit early if MultiSource has no sources
The MultiSource isn't actually properly implemented yet, but this is a minimal implementation just for the case where there are no underlying sources at all, because we use an empty MultiSource as a placeholder when a test in the "command" package fails to explicitly populate a ProviderSource.
This commit is contained in:
parent
18dd0a396d
commit
e4d7a71d91
|
@ -30,6 +30,10 @@ var _ Source = MultiSource(nil)
|
||||||
// that are available across all of the underlying selectors, while respecting
|
// that are available across all of the underlying selectors, while respecting
|
||||||
// each selector's matching patterns.
|
// each selector's matching patterns.
|
||||||
func (s MultiSource) AvailableVersions(provider addrs.Provider) (VersionList, error) {
|
func (s MultiSource) AvailableVersions(provider addrs.Provider) (VersionList, error) {
|
||||||
|
if len(s) == 0 { // Easy case: there can be no available versions
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
panic("MultiSource.AvailableVersions not yet implemented")
|
panic("MultiSource.AvailableVersions not yet implemented")
|
||||||
}
|
}
|
||||||
|
@ -37,6 +41,10 @@ func (s MultiSource) AvailableVersions(provider addrs.Provider) (VersionList, er
|
||||||
// PackageMeta retrieves the package metadata for the given provider from the
|
// PackageMeta retrieves the package metadata for the given provider from the
|
||||||
// first selector that indicates support for it.
|
// first selector that indicates support for it.
|
||||||
func (s MultiSource) PackageMeta(provider addrs.Provider, version Version, target Platform) (PackageMeta, error) {
|
func (s MultiSource) PackageMeta(provider addrs.Provider, version Version, target Platform) (PackageMeta, error) {
|
||||||
|
if len(s) == 0 { // Easy case: no providers exist at all
|
||||||
|
return PackageMeta{}, ErrProviderNotKnown{provider}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
panic("MultiSource.PackageMeta not yet implemented")
|
panic("MultiSource.PackageMeta not yet implemented")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue