Skip to content

Add imports processing when formating source files to remove unused imports#1438

Merged
stephenafamo merged 3 commits intoaarondl:masterfrom
eklatzer:ek/unused-imports-issue-1279
Apr 4, 2025
Merged

Add imports processing when formating source files to remove unused imports#1438
stephenafamo merged 3 commits intoaarondl:masterfrom
eklatzer:ek/unused-imports-issue-1279

Conversation

@eklatzer
Copy link
Contributor

@eklatzer eklatzer commented Feb 2, 2025

Fixes #1279

@stephenafamo
Copy link
Collaborator

I'm unsure how this fixes the issue

@parnic
Copy link
Contributor

parnic commented Mar 29, 2025

I'm unsure how this fixes the issue

The report is that an unused import can be generated in the file, leading to Go compile errors. This PR appears to post-process the file after it has been generated and run it through Go's own imports processor which will, I assume, remove the unused import.

https://pkg.go.dev/golang.org/x/tools/imports#Process

@eklatzer
Copy link
Contributor Author

@parnic You are correct, thanks for clarifying.
@stephenafamo Any further questions regarding this PR?

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.

Unused import "database/sql" in view models

3 participants