Skip to content

assert.EqualExportedValues - panic: reflect.MakeSlice of non-slice type [recovered] #1515

@tommynanny

Description

@tommynanny
import (
	"github.com/lib/pq"
)

type User struct {
        ...
	Roles                    pq.StringArray `json:"roles" gorm:"type:text[]"`
}

----
"github.com/lib/pq"
type StringArray []string  //https://github.com/lib/pq/blob/3d613208bca2e74f2a20e04126ed30bcb5c4cc27/array.go#L626
panic: reflect.MakeSlice of non-slice type [recovered]
        panic: reflect.MakeSlice of non-slice type

goroutine 86 [running]:
testing.tRunner.func1.2({0x1027680, 0x1246ea0})
        C:/Program Files/Go/src/testing/testing.go:1545 +0x238
testing.tRunner.func1()
        C:/Program Files/Go/src/testing/testing.go:1548 +0x397
panic({0x1027680?, 0x1246ea0?})
        C:/Program Files/Go/src/runtime/panic.go:914 +0x21f
reflect.MakeSlice({0x125aa28, 0x1100c60}, 0x10, 0x10)
        C:/Program Files/Go/src/reflect/value.go:3135 +0x171
github.com/stretchr/testify/assert.copyExportedFields({0x1100c60, 0xc0002c8e00})
        C:/Users/tommy/go/pkg/mod/github.com/stretchr/testify@v1.8.4/assert/assertions.go:113 +0x22f
github.com/stretchr/testify/assert.copyExportedFields({0x111b960, 0xc0002c8e00})
        C:/Users/tommy/go/pkg/mod/github.com/stretchr/testify@v1.8.4/assert/assertions.go:100 +0x5af
github.com/stretchr/testify/assert.ObjectsExportedFieldsAreEqual({0x111b960?, 0xc0002c8e00?}, {0x111b960, 0xc0002c9000})
        C:/Users/tommy/go/pkg/mod/github.com/stretchr/testify@v1.8.4/assert/assertions.go:144 +0x27
bitbucket.org/anra-mission-manager/mmx-registration-service/app/tests/repository_test_test.TestGetUserById.func3(0x0?)
        C:/Users/tommy/Desktop/anra/repo/mmx-registration-service/app/tests/repository_test/user_test.go:108 +0x12c
testing.tRunner(0xc0005841a0, 0xc00033d900)
        C:/Program Files/Go/src/testing/testing.go:1595 +0xff
created by testing.(*T).Run in goroutine 14
        C:/Program Files/Go/src/testing/testing.go:1648 +0x3ad
FAIL    bitbucket.org/anra-mission-manager/mmx-registration-service/app/tests/repository_test   0.873

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions