|
|
|
|
|
by throwaway894345
1501 days ago
|
|
The equivalent Go would be something like: func f[T interface{.Foo}](T) {}
Of course, this doesn't exist in Go, so we must do: func f[T interface{GetFoo(); SetFoo()}](T) {}
And then define setters and getters on every type we want to use, including defining new types (with the commensurate setters/getters) for types that we don't own (i.e., if you import a struct from another package and it doesn't have setters and getters defined, you have to create a new type that implements those setters/getters). |
|