-
Notifications
You must be signed in to change notification settings - Fork 44
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
chore: Add goimports linter for consistent imports ordering #816
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
YASSSS!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this @orpheuslummis. I made one quick request btw. Also I know this linter rule thankfully has autofix ability, so basically just doing make lint:fix
will apply these changes right?
tools/configs/golangci.yaml
Outdated
goimports: | ||
# Put imports beginning with prefix after 3rd-party packages. | ||
# It's a comma-separated list of prefixes. | ||
# Default: "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment line can go, as there is one argument you can provide goimports
anyway
# Default: "" | |
# Default: "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed the comment thanks
make lint:fix
works, but goimports
is not perfect - when the imports list is sorted strangely or in a bad shape it seems to fail at reaching the desired state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
ae6a3e9
to
9b4e236
Compare
Relevant issue(s)
Resolves #815
Description
Enablers
goimports
linter.Sorts imports using
goimports -local "github.com/sourcenetwork/defradb" -w .
https://pkg.go.dev/golang.org/x/tools/cmd/goimports is part of official go/x
Tasks
How has this been tested?
automatic lint,
make test
, eye ballingSpecify the platform(s) on which this was tested: