-
Notifications
You must be signed in to change notification settings - Fork 90
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
Gen on builtin types #89
Comments
I don’t know a good way to do this (have wanted for myself too). Aliasing is the “supported” way – gen’s supported use case is for local (package) types only. The issue is, how does one add a gen directive (comment) to a built-in type? I think this might be better implemented as a whole separate package – “genp” for primitives, or something. |
I would love it can |
This is an awkward workaround, but could you avoid this with a custom TypeWriter which ignored its primary Type and just took all of its type parameters from tag values? e.g.
This is awkward in that the FWIW I think |
@artwyman Thanks for using Yeah, my biggest blocker for primitive types is the notation — there is no type declaration to mark up. I like the markup to be in the repo, near the type. Easily understandable, self-documenting. I’m not a huge fan of command-line args though I suppose it’s not the end of the world. It means that definitions (potentially) live outside the repo, and far from the type, and it’s a little harder to give good feedback on errors. |
Hello,
Sorry if this question is answered somewhere in the docs / another issue, I was unable to find if this is currently possible.
Basically, I would like generate slices on builtin types... I'm working around it by creating type which are just aliases of the builtin, then going into the generated code and doing a find-and-replace of the function params/return values. Blek!
So, for example, I have this:
I run gen, which creates the
string_set.go
file, which I then go in and change String back to string (where it makes sense).Any thoughts? Thanks very much.
The text was updated successfully, but these errors were encountered: