Skip to content

Conversation

joshua-kim
Copy link
Contributor

@joshua-kim joshua-kim commented Jun 26, 2025

Why this should be merged

The latest version of golangci-lint (which is on homebrew/nix) uses v2, which is not compatible with the v1 schema

How this works

updates our schema using golangci-lint migrate.

How this was tested

Ran golangci-lint --fix

Need to be documented in RELEASES.md?

Yes

Signed-off-by: Joshua Kim <20001595+joshua-kim@users.noreply.github.com>
# https://golangci-lint.run/usage/configuration/
version: "2"
run:
timeout: 10m
Copy link
Contributor Author

Choose a reason for hiding this comment

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

v1 had a default timeout of 1m so we had to bump it up since our linting would sometimes take a while. V2 has no timeout by default, so this is no longer an issue. You can configure the tiemout via a parameter when running golangci-lint now

# Check for plain error comparisons.
comparison: false
forbidigo:
# Forbid the following identifiers (list of regexp).
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comments aren't migrated by migrate... so I could migrate the comments by-hand if someone requests me to.

@joshua-kim joshua-kim marked this pull request as draft June 26, 2025 15:56
# - gomnd
- goprintffuncname
- gosec
- gosimple
Copy link
Contributor Author

Choose a reason for hiding this comment

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

A lot of these linters (gosimple, stylecheck, etc) got merged into staticcheck as part of v2

@joshua-kim joshua-kim marked this pull request as ready for review June 26, 2025 16:30
@joshua-kim joshua-kim self-assigned this Jun 26, 2025
@joshua-kim joshua-kim moved this to In Progress 🏗️ in avalanchego Jun 26, 2025
@maru-ava
Copy link
Contributor

Good to see this update, but installing things from homebrew is not ideal. We want to enable local reproducibility of CI, and that requires ensuring the same versions in both places and we don't use homebrew in CI.

Any interest in porting over the work I did in hypersdk to enable versioned install of golang tools?

ava-labs/hypersdk#2030

@joshua-kim
Copy link
Contributor Author

joshua-kim commented Jun 26, 2025

Yeah I realized that this was also breaking in nix since it seems like the version of golangci-lint on nix is also on v2. Our linter script works because it uses go install on the v1 version. I do find this inconsistent behavior annoying so I do think it would be nice if we could have versioned installs.

@joshua-kim joshua-kim moved this from In Progress 🏗️ to Ready 🚦 in avalanchego Jun 26, 2025
@joshua-kim joshua-kim moved this from Ready 🚦 to In Progress 🏗️ in avalanchego Jun 26, 2025
@maru-ava
Copy link
Contributor

Would it make sense to break this PR up so that a given linter and its changes could be reviewed one-by-one (i.e. by upgrading in the initial PR but disabling failing linters)? I worry that the lack of traceability for any given change makes it all but impossible for a reviewer to do a good job.

@joshua-kim
Copy link
Contributor Author

joshua-kim commented Jun 26, 2025

Something like that could be possible. I could probably do something where we have a initial PR to migrate + any failing linters disabled, and have subsequent stacked PRs per-linter that we fix and merge down into this branch. Is that what you had in mind?

Signed-off-by: Joshua Kim <20001595+joshua-kim@users.noreply.github.com>
Signed-off-by: Joshua Kim <20001595+joshua-kim@users.noreply.github.com>
steps:
- uses: actions/checkout@v4
- uses: umbrelladocs/action-linkspector@a0567ce1c7c13de4a2358587492ed43cab5d0102 #v1.3.4
- uses: umbrelladocs/action-linkspector@v1.2.5
Copy link
Contributor Author

@joshua-kim joshua-kim Jun 27, 2025

Choose a reason for hiding this comment

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

So this line looks pretty weird. This seems to be an issue on v1.3 of this action (ref). Seems like the work-around it to downgrade in the meantime. It seems like this failed on this PR because this action only runs when *.yml and *.md files are changed by default. I'm not entirely sure why it broke on this specific PR, since we have made changes to other *.md and *.yml files before.

I re-ran the job MANY times and it did not pass until this was downgraded... so it does seem like something is actually wrong here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Please update to use the same SHA #version format used for the previous version.

steps:
- uses: actions/checkout@v4
- uses: umbrelladocs/action-linkspector@a0567ce1c7c13de4a2358587492ed43cab5d0102 #v1.3.4
- uses: umbrelladocs/action-linkspector@v1.2.5
Copy link
Contributor

Choose a reason for hiding this comment

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

Please update to use the same SHA #version format used for the previous version.

Signed-off-by: Joshua Kim <20001595+joshua-kim@users.noreply.github.com>
Signed-off-by: Joshua Kim <20001595+joshua-kim@users.noreply.github.com>
Signed-off-by: Joshua Kim <20001595+joshua-kim@users.noreply.github.com>
Signed-off-by: Joshua Kim <20001595+joshua-kim@users.noreply.github.com>
Signed-off-by: Joshua Kim <20001595+joshua-kim@users.noreply.github.com>
@StephenButtolph StephenButtolph requested a review from rrazvan1 as a code owner July 2, 2025 22:29
@StephenButtolph StephenButtolph merged commit 4202054 into master Jul 2, 2025
28 checks passed
@StephenButtolph StephenButtolph deleted the golangci-migrate branch July 2, 2025 23:00
@github-project-automation github-project-automation bot moved this from In Progress 🏗️ to Done 🎉 in avalanchego Jul 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants