hugo/tpl/collections
Bjørn Erik Pedersen 10ac2ec446 tpl/collections: Fix handling of different interface types in Slice
In Hugo `0.49` we improved type support in `slice`. This has an unfortunate side effect in that `resources.Concat` now expects something that can resolve to `resource.Resources`.

This worked for most situations, but when you try to `slice` different `Resource` objects, you would be getting `[]interface {}` and not `resource.Resources`. And `concat` would fail:

```bash
error calling Concat: slice []interface {} not supported in concat.
```

This commit fixes that by simplifying the type checking logic in `Slice`:

* If the first item implements the `Slicer` interface, we try that
* If the above fails or the first item does not implement `Slicer`, we just return the `[]interface {}`

Fixes #5269
2018-10-02 23:54:16 +03:00
..
append.go tpl/collections: Add collections.Append 2018-09-14 10:12:08 +02:00
append_test.go tpl/collections: Add collections.Append 2018-09-14 10:12:08 +02:00
apply.go
apply_test.go Add Hugo Piper with SCSS support and much more 2018-07-06 11:46:12 +02:00
collections.go tpl/collections: Fix handling of different interface types in Slice 2018-10-02 23:54:16 +03:00
collections_test.go tpl/collections: Fix handling of different interface types in Slice 2018-10-02 23:54:16 +03:00
index.go
index_test.go
init.go tpl/collections: Add collections.Append 2018-09-14 10:12:08 +02:00
init_test.go
reflect_helpers.go tpl/collections: Improve type handling in collections.Slice 2018-09-10 09:19:01 +02:00
sort.go
sort_test.go
where.go
where_test.go