Skip to content
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

feat(golangcilint): lint wire files #616

Merged
merged 1 commit into from
Dec 3, 2024
Merged

Conversation

radhus
Copy link
Member

@radhus radhus commented Dec 3, 2024

Wire is used a lot in our organization, but the linter is skipping all wire.go files due to them having a mandatory build tag.

This includes the build tag when running the linter, to make sure wire.go files are linted as well.

I would expect linter to break a lot of repos now, but likely with very easy fixes. Example:

❯ make go-lint
[sage] building binary and generating Makefiles...
[go-lint] running...
[go-lint]
internal/app/server/wire.go:61: File is not `gci`-ed with --skip-generated -s standard -s default (gci)
internal/app/server/wire.go:63: File is not `gci`-ed with --skip-generated -s standard -s default (gci)
[ ... code ... ]
internal/app/server/wire.go:62: File is not `gofumpt`-ed with `-extra` (gofumpt)
[ ... code ... ]
internal/app/server/wire.go:47:11: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
func Init(ctx context.Context, config *Config) (*App, func(), error) {

Wire is used a lot in our organization, but the linter is skipping all
wire.go files due to them having a mandatory build tag.

This includes the build tag when running the linter, to make sure
`wire.go` files are linted as well.

I would expect linter to break a lot of repos now, but likely with very
easy fixes. Example:

```
❯ make go-lint
[sage] building binary and generating Makefiles...
[go-lint] running...
[go-lint]
internal/app/server/wire.go:61: File is not `gci`-ed with --skip-generated -s standard -s default (gci)
internal/app/server/wire.go:63: File is not `gci`-ed with --skip-generated -s standard -s default (gci)
[ ... code ... ]
internal/app/server/wire.go:62: File is not `gofumpt`-ed with `-extra` (gofumpt)
[ ... code ... ]
internal/app/server/wire.go:47:11: unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
func Init(ctx context.Context, config *Config) (*App, func(), error) {
```
@radhus radhus requested a review from a team as a code owner December 3, 2024 07:44
Copy link
Member

@fredrikaverpil fredrikaverpil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noice!

tools/sggolangcilint/golangci.yml Show resolved Hide resolved
Copy link
Member

@thall thall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds reasonable to me!

@radhus radhus merged commit 334ac69 into master Dec 3, 2024
3 checks passed
@radhus radhus deleted the golangci-lint-on-wire-files branch December 3, 2024 15:32
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.

4 participants