Skip to content

Replace gofmt by goimports and move the imports the template - #226

Merged
1 commit merged into
oapi-codegen:masterfrom
curvegrid:goimports
Sep 4, 2020
Merged

1 commit merged into
oapi-codegen:masterfrom
curvegrid:goimports

Conversation

@dahu33

@dahu33 dahu33 commented Sep 3, 2020

Copy link
Copy Markdown
Contributor

This is great project with a lot of potential! In this PR I've tried to add my little contribution:

  1. Replaced gofmt by goimports: goimports does everything that gofmt do but it also groups and corrects imported packages. This will make the generated code nicer to read and reduce the probability of having a missing/incorrect import statement.

  2. Removed the imports list (and the related code) from the source code and moved them to the template. goimports will automatically "clean" the import section. This will make the templates more easily customizable (devs can add imports) without the need of modifying the import list in the source code.

@ghost

ghost commented Sep 4, 2020

Copy link
Copy Markdown

Nice! Thanks.

@ghost
ghost merged commit 3e0fd95 into oapi-codegen:master Sep 4, 2020
@dahu33
dahu33 deleted the goimports branch September 8, 2020 08:09
adrianpk pushed a commit to foorester/oapi-codegen that referenced this pull request Jan 16, 2024
This pull request was closed.
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.

1 participant