Skip to content

Migrate the golangci-lint config to v2#1583

Merged
gbotrel merged 15 commits intomasterfrom
config/golangci-lint/migrate
Aug 22, 2025
Merged

Migrate the golangci-lint config to v2#1583
gbotrel merged 15 commits intomasterfrom
config/golangci-lint/migrate

Conversation

@Tabaie
Copy link
Copy Markdown
Contributor

@Tabaie Tabaie commented Aug 20, 2025

Ran golangci-lint migrate as per https://golangci-lint.run/docs/product/migration-guide/.

stylecheck and gosimple have been subsumed into staticcheck, and as a result the latter has become a bit more strict.

Implemented the req changes for the following rules:

  • ST1016: All method receivers must have the same name.
  • QF1001: Apply DeMorgan's law to if conditions when possible
  • QF1012: Use fmt.Fprint(sb, ...) instead of sb.WriteString(fmt.Sprint(...))
  • ST1005: Error messages must not be capitalized

The following seemed like more trouble than they were worth so I disabled them:

  • QF1003: Convert if/else-if chain to tagged switch (resulted in longer code)
  • QF1008: Omit embedded fields from selector expression (many false positives resulting in ambiguity when two embedded fields contained the same method)
  • ST1003: Poorly chosen identifier (objected to all CONSTANTS_OF_THIS_FORM)

@Tabaie Tabaie requested review from Copilot and gbotrel August 20, 2025 23:11

This comment was marked as outdated.

@Tabaie Tabaie marked this pull request as draft August 21, 2025 19:23
@Tabaie Tabaie marked this pull request as ready for review August 22, 2025 18:29
@Tabaie Tabaie requested a review from Copilot August 22, 2025 18:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR migrates the golangci-lint configuration to v2 format and applies the required code changes to satisfy new linting rules. The migration improves code consistency by enforcing uniform method receiver names and applying logical simplifications.

  • Migrated golangci-lint configuration to v2 format
  • Fixed method receiver naming to ensure consistency across types
  • Applied DeMorgan's law and other logical simplifications
  • Updated string formatting to use more efficient methods

Reviewed Changes

Copilot reviewed 54 out of 55 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
test/engine.go Applied DeMorgan's law to boolean condition
test/assert.go Standardized method receiver name from a to assert
std/math/emulated/field_test.go Applied DeMorgan's law to boolean condition
std/algebra/native/sw_bls24315/pairing2.go Unified method receiver names from c/p to pr
std/algebra/native/sw_bls24315/g2.go Unified method receiver names from P to p
std/algebra/native/sw_bls24315/g1.go Unified method receiver names from P to p
std/algebra/native/sw_bls12377/pairing2.go Unified method receiver names from c/p to pr
std/algebra/native/sw_bls12377/hints.go Fixed reference operations on struct fields
std/algebra/native/sw_bls12377/g2.go Unified method receiver names from P to p
std/algebra/native/sw_bls12377/g1.go Unified method receiver names from P/R to p
std/algebra/native/fields_bls12377/e12_pairing.go Fixed method receiver name from x to e
Multiple emulated algebra files Unified method receiver names to pr
internal/smallfields/tinyfield/vector.go Added nolint comment for acceptable return pattern
internal/smallfields/tinyfield/element_test.go Added missing test case
internal/smallfields/tinyfield/element.go Improved Legendre symbol computation and documentation
Multiple constraint files Unified method receiver names from solver to s and cs to system
frontend/cs files Updated string formatting and added nolint comments
examples/rollup/rollup_test.go Added security comment for acceptable random usage
go.mod Updated dependency versions

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@gbotrel gbotrel merged commit d94eaed into master Aug 22, 2025
7 checks passed
@gbotrel gbotrel deleted the config/golangci-lint/migrate branch August 22, 2025 18:42
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.

3 participants