Skip to content
This repository was archived by the owner on Sep 4, 2025. It is now read-only.

Conversation

erikdubbelboer
Copy link

This commit fixes pointers to type aliases which are currently not
supported.

The new test cases will fail with:

jsonapi: Can't unmarshal foo (string) to struct field `String`, which is a pointer to
 `StringType (string)`

One other method to fix this when you are able to modify your types is:

type StringType = string

This is the new (since Go 1.9) way to declare type aliasses which treats
the types differently when using reflect.
See: https://github.com/golang/example/tree/master/gotypes#named-types

This commit fixes pointers to type aliases which are currently not
supported.

The new test cases will fail with:
  jsonapi: Can't unmarshal foo (string) to struct field `String`, which is a pointer to `StringType (string)`

One other method to fix this when you are able to modify your types is:

  type StringType = string

This is the new (since Go 1.9) way to declare type aliasses which treats
the types differently when using reflect.
See: https://github.com/golang/example/tree/master/gotypes#named-types
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant