Skip to content

Commit e9893b8

Browse files
committed
Fix go compatibility for <= 1.11
1 parent 6c08cda commit e9893b8

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

response.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ func visitModelNode(model interface{}, included *map[string]*Node,
406406
choiceValue := fieldValue
407407

408408
// must be a pointer type
409-
if choiceValue.Type().Kind() != reflect.Pointer {
409+
if choiceValue.Type().Kind() != reflect.Ptr {
410410
er = ErrUnexpectedType
411411
break
412412
}
@@ -430,7 +430,7 @@ func visitModelNode(model interface{}, included *map[string]*Node,
430430
for i := 0; i < fieldValue.Len(); i++ {
431431
itemValue := fieldValue.Index(i)
432432
// Once again, must be a pointer type
433-
if itemValue.Type().Kind() != reflect.Pointer {
433+
if itemValue.Type().Kind() != reflect.Ptr {
434434
er = ErrUnexpectedType
435435
break
436436
}

response_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package jsonapi
33
import (
44
"bytes"
55
"encoding/json"
6-
"errors"
76
"fmt"
87
"reflect"
98
"sort"
@@ -150,7 +149,7 @@ func TestMarshalPayloadWithManyPolyrelationWithNils(t *testing.T) {
150149
}
151150

152151
out := bytes.NewBuffer(nil)
153-
if err := MarshalPayload(out, blog); !errors.Is(err, ErrUnexpectedNil) {
152+
if err := MarshalPayload(out, blog); err != ErrUnexpectedNil {
154153
t.Fatal("expected error but got none")
155154
}
156155
}
@@ -169,7 +168,7 @@ func TestMarshalPayloadWithManyRelationWithNils(t *testing.T) {
169168
}
170169

171170
out := bytes.NewBuffer(nil)
172-
if err := MarshalPayload(out, blog); !errors.Is(err, ErrUnexpectedNil) {
171+
if err := MarshalPayload(out, blog); err != ErrUnexpectedNil {
173172
t.Fatal("expected error but got none")
174173
}
175174
}

0 commit comments

Comments
 (0)