resources: Create a common ResourceFinder interface
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Wed, 20 Oct 2021 08:11:48 +0000 (10:11 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 5 Apr 2022 16:00:44 +0000 (18:00 +0200)
commite58a540895c28b8884823dcb1b64c272422f9923
tree3fefb267f87e61a969a6ccf776d75fe64b50b2b1
parent20162518c450770ebfd54e0e987f34a5cccf236b
resources: Create a common ResourceFinder interface

And make both .Resources and resources implement it.

This gets us 2 new methods/functions, so you can now also do:

* .Resources.Get
* resources.ByType

Note that GetRemote is not covered by this interface, as that is only available as a global template function.

Fixes #8653
common/types/hstring/stringtypes_test.go
hugolib/hugo_sites_build_test.go
hugolib/pagebundler_test.go
hugolib/resource_chain_test.go
resources/resource/resources.go
resources/resource_factories/create/create.go
tpl/resources/resources.go