Skip to content

Conversation

RodrigoVillar
Copy link
Contributor

@RodrigoVillar RodrigoVillar commented Jul 11, 2025

While looking into Taskfiles for ffi, I noticed that we're still using golangci-lint v1 while AvalancheGo is already using golangci-lint v2. This PR upgrades the version of golangci-lint used in ffi to v2.

To maintain synchrony between the Firewood and AvalancheGo linter rules, an additional CI job (expected-golangci-yaml-diff) ensures that the difference between the two .golangci.yaml files is equal to the contents of golangci_yaml_expected_changes.txt.

What

  • Copied over current AvalancheGo golangci.yml file and removing AvalancheGo-specific rules.
  • Bumped version of golangci-lint action used in CI.
  • Added expected-golangci-yaml-diff CI job
  • Linted files

How This Was Tested

Ran golangci-lint locally + CI.

@RodrigoVillar RodrigoVillar self-assigned this Jul 11, 2025
@RodrigoVillar RodrigoVillar marked this pull request as ready for review July 11, 2025 15:32
Copy link
Collaborator

@rkuris rkuris left a comment

Choose a reason for hiding this comment

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

Questions:

Is there any way to share the linter configuration between these two projects?
(if no) Can you provide a pointer to where this is being done in avalanchego so I can compare?
(if yes) let's do that instead!

@RodrigoVillar
Copy link
Contributor Author

@rkuris I don't believe there's a way to share linter configs between the two projects.

Linter rules in AvalancheGo: https://github.com/ava-labs/avalanchego/blob/master/.golangci.yml

@rkuris
Copy link
Collaborator

rkuris commented Jul 11, 2025

@rkuris I don't believe there's a way to share linter configs between the two projects.

Linter rules in AvalancheGo: https://github.com/ava-labs/avalanchego/blob/master/.golangci.yml

I'm worried about them getting out of sync again. Possible solutions:

1 - Generate the golangci.yml file by fetching it from avalanchego's main and tweaking it before running the ci rule
2 - Add a new ci rule that verifies that it only contains the expected changes
3 - Use build.rs in the ffi directory to fetch avalanchego's rules and update them if necessary.

These are in order of preference.

@RodrigoVillar
Copy link
Contributor Author

@rkuris I don't believe there's a way to share linter configs between the two projects.
Linter rules in AvalancheGo: https://github.com/ava-labs/avalanchego/blob/master/.golangci.yml

I'm worried about them getting out of sync again. Possible solutions:

1 - Generate the golangci.yml file by fetching it from avalanchego's main and tweaking it before running the ci rule 2 - Add a new ci rule that verifies that it only contains the expected changes 3 - Use build.rs in the ffi directory to fetch avalanchego's rules and update them if necessary.

These are in order of preference.

Went with the second option. The expected diff between the Firewood and AvalancheGo .golangci.yml files is now stored in golangci_yaml_expected_changes.txt and is verified by the expected-golangci-yaml-diff CI job: b7d7197

@rkuris rkuris added the devops label Jul 11, 2025
Copy link
Collaborator

@rkuris rkuris left a comment

Choose a reason for hiding this comment

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

Approved with nits

@RodrigoVillar RodrigoVillar enabled auto-merge (squash) July 14, 2025 15:19
run:
timeout: 10m
Copy link
Contributor

Choose a reason for hiding this comment

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

Why remove the timeout?

@RodrigoVillar RodrigoVillar merged commit da2c55d into main Jul 15, 2025
34 checks passed
@RodrigoVillar RodrigoVillar deleted the RodrigoVillar/upgrade-go-lint branch July 15, 2025 21:21
rkuris pushed a commit that referenced this pull request Jul 16, 2025
While looking into Taskfiles for `ffi`, I noticed that we're still using
`golangci-lint v1` while AvalancheGo is already using `golangci-lint
v2`. This PR upgrades the version of `golangci-lint` used in `ffi` to
`v2`.

To maintain synchrony between the Firewood and AvalancheGo linter rules,
an additional CI job (`expected-golangci-yaml-diff`) ensures that the
difference between the two `.golangci.yaml` files is equal to the
contents of `golangci_yaml_expected_changes.txt`.

## What

- Copied over current AvalancheGo `golangci.yml` file and removing
AvalancheGo-specific rules.
- Bumped version of `golangci-lint` action used in CI.
- Added `expected-golangci-yaml-diff` CI job
- Linted files

## How This Was Tested

Ran `golangci-lint` locally + CI.
KushnerykPavel pushed a commit to KushnerykPavel/firewood that referenced this pull request Jul 17, 2025
While looking into Taskfiles for `ffi`, I noticed that we're still using
`golangci-lint v1` while AvalancheGo is already using `golangci-lint
v2`. This PR upgrades the version of `golangci-lint` used in `ffi` to
`v2`.

To maintain synchrony between the Firewood and AvalancheGo linter rules,
an additional CI job (`expected-golangci-yaml-diff`) ensures that the
difference between the two `.golangci.yaml` files is equal to the
contents of `golangci_yaml_expected_changes.txt`.

## What

- Copied over current AvalancheGo `golangci.yml` file and removing
AvalancheGo-specific rules.
- Bumped version of `golangci-lint` action used in CI.
- Added `expected-golangci-yaml-diff` CI job
- Linted files

## How This Was Tested

Ran `golangci-lint` locally + CI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants