-
Notifications
You must be signed in to change notification settings - Fork 2
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
Anthony/add expanders #63
base: main
Are you sure you want to change the base?
Conversation
tools/expander.go
Outdated
) | ||
|
||
const ( | ||
atTypeApp = "type.googleapis.com/c1.api.app.v1.App" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we export these const from the SDK anywhere? shouldn't we?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I exported them
} | ||
|
||
// Use reflection to call the `GetAtType` method on an pointer receiver, func GetAtType() *string. | ||
func GetAtTypeWithReflection[T any](input *T) *string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't this be T getAtType
with type getAtType interface{ GetAtType() *string }
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get this error type *T is pointer to type parameter, not type parameter
because:
The method set of *T does not automatically include pointer receiver methods declared on the T's concrete type A, and it does not implement interfaces that would be implemented by *A.
I cant think of a better way of doing this since I am doing this weird thing where I call both a pointer receiver function and a normal function.
On hold for now
I made the expander code in the cone repo into a tools package for the go sdk. I used a more idiomatic way of representing generics and reflection to eliminate some of the boiler plate required.