Skip to content

Conversation

@Joffref
Copy link
Owner

@Joffref Joffref commented Jan 8, 2024

No description provided.

@leorolland leorolland self-assigned this Jan 8, 2024
@leorolland
Copy link
Collaborator

love it

@Joffref Joffref requested a review from leorolland January 9, 2024 09:29
return c
}

func (c *Code) WithNamedImports(namedImports map[string]string) *Code {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


func (c *Code) Generate() error {
var buf bytes.Buffer
if len(c.headerComments) > 0 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if len(c.headerComments) > 0 {

return fmt.Errorf("package name is required")
}

if len(c.imports) > 0 || len(c.namedImports) > 0 {
Copy link
Collaborator

@leorolland leorolland Jan 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gofmt should automatically remove useless closes like

import (
)
Suggested change
if len(c.imports) > 0 || len(c.namedImports) > 0 {

same for the rest \n outside function bodies

Signed-off-by: Joffref <[email protected]>
@Joffref Joffref linked an issue Jan 22, 2024 that may be closed by this pull request
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement]: Consume GenZ as code - Proposal WIP

3 participants