Skip to content

Commit

Permalink
Merge pull request #11 from thecasualcoder/fix-lint-issues
Browse files Browse the repository at this point in the history
Fix lint issues
  • Loading branch information
aswinkarthik authored Oct 13, 2019
2 parents 60c66ab + 92b9263 commit 6cd13fa
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 17 deletions.
1 change: 0 additions & 1 deletion common.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"reflect"
)


func validateOut(output reflect.Value) error {
zeroValue := reflect.Value{}
if output == zeroValue {
Expand Down
2 changes: 1 addition & 1 deletion filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
// Validations:
//
// 1. Input and Output's slice should be of same type
// 2. Predicate function can take one argment and return one argument
// 2. Predicate function can take one argument and return one argument
// 3. Predicate's return argument is always boolean.
// 4. Predicate's input argument should be input/output slice's element type.
//
Expand Down
15 changes: 7 additions & 8 deletions filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,22 @@ func TestFilter(t *testing.T) {

t.Run("should struct types", func(t *testing.T) {
type person struct {
name string
age int
age int
}
input := []person{
{"john", 30},
{"doe", 20},
{"foo", 40},
{"bar", 10},
{30},
{20},
{40},
{10},
}
var output []person

err := godash.Filter(input, &output, func(p person) bool {
return p.age > 20
})
expected := []person{
{"john", 30},
{"foo", 40},
{30},
{40},
}

assert.NoError(t, err)
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
Expand Down
5 changes: 2 additions & 3 deletions map_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,11 @@ func TestMap(t *testing.T) {
t.Run("support structs", func(t *testing.T) {
type person struct {
name string
age int
}

in := []person{
{name: "john", age: 20},
{name: "doe", age: 23},
{name: "john"},
{name: "doe"},
}
out := make([]string, 0)
expected := []string{"john", "doe"}
Expand Down
7 changes: 3 additions & 4 deletions reduce_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,12 @@ func TestReduce(t *testing.T) {

t.Run("support structs", func(t *testing.T) {
type person struct {
name string
age int
age int
}

in := []person{
{name: "john", age: 20},
{name: "doe", age: 23},
{age: 20},
{age: 23},
}
out := 0
expected := 43
Expand Down

0 comments on commit 6cd13fa

Please sign in to comment.