Closed deosjr closed 3 years ago
Consider the following code:
type X struct {} type Y map[string]*X func test(y Y) { yy := map[string]*X(y) for _, k := range deriveSorted(deriveKeys(yy)) { fmt.Println(y[k]) } }
If we remove the typecast on y and try to use deriveKeys on y directly, removing yy entirely, goderive will fail saying:
could not yet generate: deriveSorted(deriveKeys(y)) Generator Error: keys:deriveKeys, the first argument, github.com/deosjr/test.Y, is not of type map
The first line is still shown when deriving on the typecast yy map, but derive works correctly in that case
yy
Thank you for reporting. This should be fixable using the .Underlying() method, if I recall correctly.
.Underlying()
Consider the following code:
If we remove the typecast on y and try to use deriveKeys on y directly, removing yy entirely, goderive will fail saying:
The first line is still shown when deriving on the typecast
yy
map, but derive works correctly in that case