Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Golang. Add a property to a struct at runtime

Tags:

reflection

go

class type User {
    name string
}

Is it possible to add a field age at runtime?

like image 321
findly Avatar asked Aug 15 '15 15:08

findly


1 Answers

No it is not possible.

Not even with Java or C++ syntax instead of valid Go.

like image 84
Volker Avatar answered Sep 23 '22 03:09

Volker