Skip to content
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

Go: prepend struct field comment (support GoDoc) #1553

Merged
merged 18 commits into from Jan 7, 2023

Conversation

cv
Copy link
Contributor

@cv cv commented Sep 2, 2020

This makes the Go generator prepend struct field comments, so instead of:

type Bar struct {
  Foo string `json:"foo"` // this bar's foo
}

...we get:

type Bar struct {
  // this bar's foo
  Foo string `json:"foo"`
}

...which GoDoc supports and documents accordingly.

@bruth
Copy link

bruth commented Jun 24, 2021

Bump for this to get merged..

@dvdsgl
Copy link
Member

dvdsgl commented Jan 3, 2023

@cv thank you! There is a small build error.

@dvdsgl
Copy link
Member

dvdsgl commented Jan 3, 2023

Including the comments in the column formatting produces code that gofmt does not like:

CleanShot 2023-01-03 at 11 29 00@2x

gofmt does:

CleanShot 2023-01-03 at 11 29 45@2x

@cv
Copy link
Contributor Author

cv commented Jan 3, 2023

@dvdsgl is the expectation that the code generated by the tool passes gofmt without change?

In some of our projects that involve Go code generation we've been successful so far with letting the generator make a bit of a mess, then let gofmt clean everything up later.

@dvdsgl dvdsgl merged commit 740de7c into glideapps:master Jan 7, 2023
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.

None yet

3 participants