Type that is another type type how to get that type

type General string

type SpecificA General

type SpecificB General

type SpecificC General

I get the following error when I compile this and try and supply a Specific? type where I have a General type …

cannot use ot (variable of type ObjectType) as Type value in struct literal

is there a way to convert a Specific? type to General type so I can test code written to work on General?

Hi @jarrodhroberson ,

(Edited)

Try type conversion in your tests:

    var a SpecificA = "abc"
    g := General(a)

Playground Link

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.