-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Add support for datetime type #1
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
Conversation
|
Maybe the parts of generating import code are too complex 🤣 |
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.
Left some minor comments. Other than that, looks good!
pkg/gen/gogen.go
Outdated
| // 3. Third-party imports (sorted) | ||
| // 4. Blank line | ||
| // 5. Local/project imports (sorted) | ||
| func (gen *CodeGenerator) generateImports(requiredImports map[string]bool) { |
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 think we can use golang.org/x/tools/imports package to format code. That also handles imports.
Example:
formattedSrc, err := imports.Process("", src, nil)
if err != nil {
log.Fatal(err)
}
fmt.Println(string(formattedSrc))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.
using golang.org/x/tools/imports is a realy eazy way to format our generated code, this makes it completely unnecessary for us to import via a slice of constants.
|
Thanks, @brucechen7274! |
What have I done:
Other things:
If my implementation is okay, do I need to change the date-related fields in the example from string to datetime?