summaryrefslogtreecommitdiffstats
path: root/common/collections
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-12-02 13:23:25 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-12-03 13:12:58 +0100
commitd90e37e0c6e812f9913bf256c9c81aa05b7a08aa (patch)
tree7b1b14464eefec1188ca2eed53c64e4823453cc9 /common/collections
parent32471b57bde51c55a15dbf1db75d6e5f7232c347 (diff)
all: Format code with gofumpt
See https://github.com/mvdan/gofumpt
Diffstat (limited to 'common/collections')
-rw-r--r--common/collections/append.go1
-rw-r--r--common/collections/append_test.go43
-rw-r--r--common/collections/slice_test.go14
3 files changed, 36 insertions, 22 deletions
diff --git a/common/collections/append.go b/common/collections/append.go
index b56455bc9..d6fb89241 100644
--- a/common/collections/append.go
+++ b/common/collections/append.go
@@ -51,7 +51,6 @@ func Append(to interface{}, from ...interface{}) (interface{}, error) {
} else if !fromt.AssignableTo(tot) {
// Fall back to a []interface{} slice.
return appendToInterfaceSliceFromValues(tov, fromv)
-
}
}
}
diff --git a/common/collections/append_test.go b/common/collections/append_test.go
index 4086570b8..7d6117de8 100644
--- a/common/collections/append_test.go
+++ b/common/collections/append_test.go
@@ -36,28 +36,44 @@ func TestAppend(t *testing.T) {
{nil, []interface{}{"a", "b"}, []string{"a", "b"}},
{nil, []interface{}{nil}, []interface{}{nil}},
{[]interface{}{}, []interface{}{[]string{"c", "d", "e"}}, []string{"c", "d", "e"}},
- {tstSlicers{&tstSlicer{"a"}, &tstSlicer{"b"}},
+ {
+ tstSlicers{&tstSlicer{"a"}, &tstSlicer{"b"}},
[]interface{}{&tstSlicer{"c"}},
- tstSlicers{&tstSlicer{"a"}, &tstSlicer{"b"}, &tstSlicer{"c"}}},
- {&tstSlicers{&tstSlicer{"a"}, &tstSlicer{"b"}},
+ tstSlicers{&tstSlicer{"a"}, &tstSlicer{"b"}, &tstSlicer{"c"}},
+ },
+ {
+ &tstSlicers{&tstSlicer{"a"}, &tstSlicer{"b"}},
[]interface{}{&tstSlicer{"c"}},
- tstSlicers{&tstSlicer{"a"},
+ tstSlicers{
+ &tstSlicer{"a"},
&tstSlicer{"b"},
- &tstSlicer{"c"}}},
- {testSlicerInterfaces{&tstSlicerIn1{"a"}, &tstSlicerIn1{"b"}},
+ &tstSlicer{"c"},
+ },
+ },
+ {
+ testSlicerInterfaces{&tstSlicerIn1{"a"}, &tstSlicerIn1{"b"}},
[]interface{}{&tstSlicerIn1{"c"}},
- testSlicerInterfaces{&tstSlicerIn1{"a"}, &tstSlicerIn1{"b"}, &tstSlicerIn1{"c"}}},
+ testSlicerInterfaces{&tstSlicerIn1{"a"}, &tstSlicerIn1{"b"}, &tstSlicerIn1{"c"}},
+ },
//https://github.com/gohugoio/hugo/issues/5361
- {[]string{"a", "b"}, []interface{}{tstSlicers{&tstSlicer{"a"}, &tstSlicer{"b"}}},
- []interface{}{"a", "b", &tstSlicer{"a"}, &tstSlicer{"b"}}},
- {[]string{"a", "b"}, []interface{}{&tstSlicer{"a"}},
- []interface{}{"a", "b", &tstSlicer{"a"}}},
+ {
+ []string{"a", "b"},
+ []interface{}{tstSlicers{&tstSlicer{"a"}, &tstSlicer{"b"}}},
+ []interface{}{"a", "b", &tstSlicer{"a"}, &tstSlicer{"b"}},
+ },
+ {
+ []string{"a", "b"},
+ []interface{}{&tstSlicer{"a"}},
+ []interface{}{"a", "b", &tstSlicer{"a"}},
+ },
// Errors
{"", []interface{}{[]string{"a", "b"}}, false},
// No string concatenation.
- {"ab",
+ {
+ "ab",
[]interface{}{"c"},
- false},
+ false,
+ },
} {
result, err := Append(test.start, test.addend...)
@@ -71,5 +87,4 @@ func TestAppend(t *testing.T) {
c.Assert(err, qt.IsNil)
c.Assert(result, qt.DeepEquals, test.expected)
}
-
}
diff --git a/common/collections/slice_test.go b/common/collections/slice_test.go
index 3ebfe6d11..93bad84da 100644
--- a/common/collections/slice_test.go
+++ b/common/collections/slice_test.go
@@ -20,11 +20,13 @@ import (
qt "github.com/frankban/quicktest"
)
-var _ Slicer = (*tstSlicer)(nil)
-var _ Slicer = (*tstSlicerIn1)(nil)
-var _ Slicer = (*tstSlicerIn2)(nil)
-var _ testSlicerInterface = (*tstSlicerIn1)(nil)
-var _ testSlicerInterface = (*tstSlicerIn1)(nil)
+var (
+ _ Slicer = (*tstSlicer)(nil)
+ _ Slicer = (*tstSlicerIn1)(nil)
+ _ Slicer = (*tstSlicerIn2)(nil)
+ _ testSlicerInterface = (*tstSlicerIn1)(nil)
+ _ testSlicerInterface = (*tstSlicerIn1)(nil)
+)
type testSlicerInterface interface {
Name() string
@@ -54,7 +56,6 @@ func (p *tstSlicerIn1) Slice(in interface{}) (interface{}, error) {
default:
return nil, errors.New("invalid type")
}
-
}
return result, nil
}
@@ -120,5 +121,4 @@ func TestSlice(t *testing.T) {
c.Assert(test.expected, qt.DeepEquals, result, errMsg)
}
-
}