Skip to content

Conversation

litt3
Copy link
Contributor

@litt3 litt3 commented Jul 30, 2025

  • This PR modfies the github linter action to only lint the diff between a PR branch and the base branch
  • This PR enables revive and some other linting rules
  • This PR removes the separate proxy linting rules and CI action.
    • Now that proxy is part of mono repo, it makes sense to just define this stuff once

@litt3 litt3 self-assigned this Jul 30, 2025
Copy link

github-actions bot commented Jul 30, 2025

The latest Buf updates on your PR. Results from workflow Buf Proto / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedAug 1, 2025, 1:17 PM

@litt3 litt3 marked this pull request as ready for review July 30, 2025 17:57
dmanc
dmanc previously approved these changes Jul 30, 2025
@litt3 litt3 requested a review from a team as a code owner July 30, 2025 20:06
@litt3 litt3 requested a review from dmanc July 30, 2025 20:06
@litt3 litt3 changed the title feat: Enable revive linter just for new changes feat: Enable additional linter rules just for new changes Jul 30, 2025
@litt3 litt3 requested a review from bxue-l2 July 30, 2025 20:19
@litt3
Copy link
Contributor Author

litt3 commented Jul 30, 2025

@anupsv This PR removes the separate proxy linting CI action.

I think it needs to be removed from the list of required actions, but AFAICT I don't have the permissions do to this. Would you mind doing that for me?

samlaf
samlaf previously approved these changes Jul 31, 2025
Copy link
Collaborator

@samlaf samlaf left a comment

Choose a reason for hiding this comment

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

LGTM. Left some nits but happy merging this as is

- unused # checks for unused constants, variables, functions and types
- unconvert # removes unnecessary type conversions
- wrapcheck # checks that errors returned from external packages are wrapped
- exhaustruct # checks if all structure fields are initialized
Copy link
Collaborator

Choose a reason for hiding this comment

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

this I think can be annoying, and also goes against the golang philosophy of not initializing default values?

Copy link
Contributor Author

@litt3 litt3 Jul 31, 2025

Choose a reason for hiding this comment

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

golang philosophy of not initializing default values

I feel pretty strongly that this philosophy is a foot gun. We've seen first hand multiple critical bugs that came about because of this!

Essentially, this linter forces you to use raw struct initialization like you'd use a constructor, where each field is a parameter. For cases where you want some default values, you should just create a constructor that accepts any arbitrary parameters, and explicitly configures each struct field internally, IMO

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think I can agree to this. Even stronger claim is that having "useful zero values" is a mistake (see https://news.ycombinator.com/item?id=26637510) and is one of the reasons why golang will never be able to add an Option type.

One possible counter-argument is if a config struct has a lot of useful default zero values (for example in test), and I want to only change one or two for a specific test. Then if I'm force to add all the other zero values because of this linter, it makes it harder to see which values are actually important/valuable to my test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

One possible counter-argument is if a config struct has a lot of useful default zero values

Fair point. I think in this case, I still prefer adding test overhead to gain the added safety. There's always the option of making a "default config", which in practice sidesteps this linting rule, and lets you rely on default values.

anupsv
anupsv previously approved these changes Jul 31, 2025
@@ -16,11 +16,18 @@ jobs:
steps:
- name: Checkout EigenDA
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #4.2.2
with:
fetch-depth: 0 # Fetch all history for all branches so golangci-lint can analyze the diff

- uses: jdx/mise-action@v2
Copy link
Contributor

Choose a reason for hiding this comment

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

can we use the hash here as well please.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You mean for mise?

I can open a separate PR for that if you'd like, since it's not related to this linter change.

bxue-l2
bxue-l2 previously approved these changes Jul 31, 2025
Copy link
Contributor

@bxue-l2 bxue-l2 left a comment

Choose a reason for hiding this comment

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

lgtm

samlaf
samlaf previously approved these changes Aug 1, 2025
@@ -37,7 +37,6 @@ protoc-local:

lint:
golangci-lint run
go vet ./...
# Uncomment this once we update to go1.23 which makes the -diff flag available.
# See https://tip.golang.org/doc/go1.23#go-command
# go mod tidy -diff
Copy link
Collaborator

Choose a reason for hiding this comment

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

how about we uncomment this line that I forgot to uncomment and also add it to CI?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok with me doing this in a followup PR, to avoid doubling up on PR purpose?

@litt3 litt3 dismissed stale reviews from samlaf, bxue-l2, and anupsv via 0320163 August 1, 2025 13:17
@litt3 litt3 added this pull request to the merge queue Aug 1, 2025
Merged via the queue into master with commit fe3e792 Aug 1, 2025
29 checks passed
@litt3 litt3 deleted the enable-revive branch August 1, 2025 14:02
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.

5 participants