-
Notifications
You must be signed in to change notification settings - Fork 1
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
Enable gci linter with automatic fix. Apply lint fixes. #236
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.
I 100% agree that gci
should flag these.
The style we normally use is:
import (
std
default
github.com/pulumi/upgrade-provider/* // (local) imports
)
I believe we can configure gci
to support this.
Makefile
Outdated
@@ -11,7 +11,7 @@ install: | |||
go install github.com/pulumi/upgrade-provider | |||
|
|||
lint: | |||
golangci-lint run | |||
golangci-lint run -E gci --fix |
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.
My prior is that make lint
shouldn't make code changes. Instead changes should be delegated to another command, such as make lint.fix
.
-E
-> --enable
because I didn't know what -E
meant, but --enable
is readable.
golangci-lint run -E gci --fix | |
golangci-lint run --enable gci |
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.
Yeah, that's totally fair - I think a good state is where we can run make lint
and see necessary changes.
Do we have these standards documented somewhere? I looked into it and we can definitely configure custom rules. |
Not that I'm aware of. I see two patterns in our code bases:
I'm fine with either. |
This change adds linting for Go import sections following current practices in our repositories of grouping by the following custom order: - standard library - blank imports - default imports - imports for Pulumi libraries - local package imports
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.
Awesome! LGTM!
This PR is part of a migration to standardize the order and grouping of our Go imports. See pulumi/upgrade-provider#236.
This PR is part of a migration to standardize the order and grouping of our Go imports. See pulumi/upgrade-provider#236.
This PR is part of a migration to standardize the order and grouping of our Go imports. See pulumi/upgrade-provider#236.
If we want to standardize import grouping and sorting, we should enforce it in code.