nsmithuk / local-kms

A mock version of AWS' Key Management Service, for local development and testing.
MIT License
198 stars 34 forks source link

Proposal: `go fmt` this codebase #19

Closed onematchfox closed 3 years ago

onematchfox commented 3 years ago

I am currently working on implementing some of the missing KMS functionality in this repository (importing key material). I have my local IDE setup to run go fmt on file save which results in a much larger change set than is strictly needed and slows me down as I now need to try and selectively pick out my changes from the linting changes made by gofmt when committing. This has left me wondering if you be opening to using gofmt to ensure a consistent coding style on this repo?

For a sample of the changes:

This would resolve spacing issues seen here https://github.com/nsmithuk/local-kms/blob/f1cc916e5dfc85e0c6a3c57e0a2971486c267d7a/src/cmk/key.go#L14-L23

and also adjustments like:

_, ok := err.(base64.CorruptInputError)
if ok {

vs https://github.com/nsmithuk/local-kms/blob/f1cc916e5dfc85e0c6a3c57e0a2971486c267d7a/src/handler/decrypt.go#L19

and a bunch of other smaller differences in style in various places.

onematchfox commented 3 years ago

When typing the examples in the issue description I figured it was probably easier to actually just submit a PR with the full changeset for review.

nsmithuk commented 3 years ago

Hi @onematchfox Thank you for the PR. Can I just ask what the specific command was that you ran? Is it just go fmt . in the root of the repository?

onematchfox commented 3 years ago

Can I just ask what the specific command was that you ran? Is it just go fmt . in the root of the repository?

Hi @nsmithuk Running just go fmt . will only run for the current folder. I ran go fmt ./... from the root of the repo - which runs over all files in all sub-directories.

nsmithuk commented 3 years ago

Thanks @onematchfox