This pull request adds a pre-commit hook to run goimports on any Go code in a repository.
๐ญ Motivation and context
Just as we use code formatters for other languages we use (black and isort for Python as an example) it would be good to do so for any Go code. The goimports tool takes the functionality of gofmt and adds import sorting/organization.
๐งช Testing
Automated tests pass. I verified that this will format code automatically against code locally and then this branch of cisagov/skeleton-golang-package had expected output since the code is already formatted by goimports.
โ Pre-approval checklist
[x] This PR has an informative and human-readable title.
[x] Changes are limited to a single goal - eschew scope creep!
[x] All relevant type-of-change labels have been added.
๐ฃ Description
This pull request adds a pre-commit hook to run goimports on any Go code in a repository.
๐ญ Motivation and context
Just as we use code formatters for other languages we use (black and isort for Python as an example) it would be good to do so for any Go code. The goimports tool takes the functionality of gofmt and adds import sorting/organization.
๐งช Testing
Automated tests pass. I verified that this will format code automatically against code locally and then this branch of cisagov/skeleton-golang-package had expected output since the code is already formatted by goimports.
โ Pre-approval checklist
โ Pre-merge checklist