Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent behavior w/ reflect.TypeOf #225

Closed
icncsx opened this issue Jan 11, 2021 · 1 comment
Closed

Inconsistent behavior w/ reflect.TypeOf #225

icncsx opened this issue Jan 11, 2021 · 1 comment
Labels

Comments

@icncsx
Copy link

icncsx commented Jan 11, 2021

type T string

t := T("what")
tt := reflect.TypeOf(t)
fmt.Println(tt) // prints string, should be main.T
@cosmos72
Copy link
Member

cosmos72 commented Jan 12, 2021

This is a known limitation:
Go standard library does not provide any way to create new named types at runtime - only new unnamed types can be created.

Thus it's currently not possible to fix this issue.

There is an open enhancement proposal golang/go#39717 for adding such feature to Go standard library - I started implementing it some months ago, but it's still unfinished

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants