Skip to content

Comments

chore: enable goimports#3096

Draft
tac0turtle wants to merge 1 commit intomainfrom
markko/goimpot_fix
Draft

chore: enable goimports#3096
tac0turtle wants to merge 1 commit intomainfrom
markko/goimpot_fix

Conversation

@tac0turtle
Copy link
Contributor

Overview

This pr enables goimport as a linter and then runs it

@github-actions
Copy link
Contributor

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

BuildFormatLintBreakingUpdated (UTC)
✅ passed⏩ skipped✅ passed✅ passedFeb 22, 2026, 11:56 AM

@claude
Copy link
Contributor

claude bot commented Feb 22, 2026

Claude finished @tac0turtle's task in 2m 20s —— View job


Code Review

  • Gather context and read key files
  • Review .golangci.yml configuration
  • Review import changes across changed files
  • Check for correctness and idiomatic Go patterns
  • Provide final review feedback

Summary

This is a clean, purely mechanical PR that adds gci as a formatter in .golangci.yml and brings all Go files' import blocks into compliance. No logic changes were made — all 243 lines changed are import reorganizations.

One terminology note: The PR title says "enable goimports" but the actual tool being added is gci (Go Condition Import), not goimports. Both deal with import formatting, but gci provides finer-grained section control. This is not a functional issue, just worth noting in the commit message/title for clarity.


.golangci.yml Configuration

The gci section ordering in .golangci.yml:41-50 is:

sections:
  - standard
  - default
  - prefix(github.com/evstack)
  - prefix(github.com/evstack/ev-node)

This is correct. With custom-order: true, gci assigns each import to the most specific (longest) matching prefix. So:

  • github.com/evstack/ev-node/... → section 4 (most specific)
  • github.com/evstack/<other-repo>/... → section 3 (if such packages are ever added)
  • Everything else → section 2 (default)

Currently section 3 (prefix(github.com/evstack)) is effectively unused since all evstack imports in this project are github.com/evstack/ev-node/.... This is fine — it future-proofs against other evstack modules being added as dependencies.


Import Ordering Verification

All files correctly follow the 3-group pattern (section 3 is empty/omitted since no non-ev-node evstack packages are used):

stdlib imports

third-party imports (celestia, ipfs, libp2p, zerolog, stretchr, etc.)

github.com/evstack/ev-node/... imports

Spot-checked files are all consistent:

  • block/internal/executing/executor.goipfs/go-datastore, libp2p, rs/zerolog correctly moved to third-party; ev-node imports remain in project section ✓
  • pkg/rpc/server/server.goencoding/binary, errors, net/http previously incorrectly split from other stdlib imports; now correctly grouped ✓
  • pkg/config/config.godatypes "github.com/evstack/ev-node/pkg/da/types" correctly separated from github.com/mitchellh, github.com/spf13
  • node/helpers_test.gogithub.com/celestiaorg/utils/test correctly stays in third-party, not in the ev-node section ✓

Minor Observations

Blank line cleanup (block/internal/cache/generic_cache.go, block/internal/pruner/pruner.go, etc.): Spurious blank lines within import groups (between two github.com/evstack/ev-node imports or within stdlib) are correctly removed. This is expected gci behavior.

pkg/rpc/server/server.go:2-8: The fix here is notably more impactful — encoding/binary and errors were previously listed after a third-party separator, which was wrong. They're now correctly in the stdlib block.


Overall Assessment

Approved. The changes are correct and consistent across all 58 files. The gci configuration properly enforces the intended 4-section import order. This is good hygiene work that will prevent import ordering drift going forward. No functional changes, no introduced bugs.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @tac0turtle, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances code consistency and maintainability by integrating and applying the gci formatter. The primary goal was to enforce a standardized import order across all Go files, which improves readability and reduces merge conflicts related to import statements. This change ensures that the project adheres to a uniform code style, making it easier for developers to navigate and contribute to the codebase.

Highlights

  • Code Formatting: Enabled the gci formatter (a goimports variant) in the .golangci.yml configuration to standardize import ordering across the codebase.
  • Import Reordering: Applied gci across numerous Go files, resulting in reordered import statements for consistency and adherence to best practices.
  • Minor Code Refinements: Introduced minor syntax updates in a few files, such as using fmt.Appendf and simplified empty byte slice literals, likely as a side effect of running formatters or general cleanup.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • .golangci.yml
    • Enabled the gci formatter in the formatters section.
  • apps/evm/main.go
    • Reordered import statements.
  • apps/evm/server/force_inclusion_test.go
    • Reordered import statements.
  • apps/grpc/main.go
    • Reordered import statements.
  • apps/testapp/cmd/rollback.go
    • Reordered import statements.
  • apps/testapp/kv/kvexecutor.go
    • Reordered import statements.
  • block/internal/cache/generic_cache.go
    • Reordered import statements.
  • block/internal/common/expected_interfaces.go
    • Reordered import statements.
  • block/internal/da/async_block_retriever_test.go
    • Reordered import statements.
  • block/internal/da/client.go
    • Reordered import statements.
  • block/internal/da/client_test.go
    • Reordered import statements.
  • block/internal/executing/executor.go
    • Reordered import statements.
  • block/internal/executing/executor_benchmark_test.go
    • Updated transaction creation to use fmt.Appendf.
    • Reordered import statements.
  • block/internal/executing/executor_logic_test.go
    • Reordered import statements.
  • block/internal/executing/pending.go
    • Reordered import statements.
  • block/internal/pruner/pruner.go
    • Reordered import statements.
  • block/internal/submitting/batching_strategy_test.go
    • Reordered import statements.
  • block/internal/submitting/submitter_test.go
    • Reordered import statements.
  • block/internal/syncing/raft_retriever.go
    • Reordered import statements.
  • block/internal/syncing/syncer.go
    • Reordered import statements.
  • block/internal/syncing/syncer_benchmark_test.go
    • Reordered import statements.
  • block/internal/syncing/syncer_test.go
    • Reordered import statements.
  • block/public.go
    • Reordered import statements.
  • core/sequencer/sequencing_test.go
    • Updated empty byte slice literal from []byte{} to {}.
    • Reordered import statements.
  • node/failover.go
    • Reordered import statements.
  • node/full.go
    • Reordered import statements.
  • node/helpers_test.go
    • Reordered import statements.
  • node/sequencer_recovery_integration_test.go
    • Reordered import statements.
  • pkg/cmd/p2p.go
    • Reordered import statements.
  • pkg/cmd/run_node_test.go
    • Reordered import statements.
  • pkg/config/config.go
    • Reordered import statements.
  • pkg/da/jsonrpc/client_test.go
    • Reordered import statements.
  • pkg/p2p/client_test.go
    • Reordered import statements.
  • pkg/rpc/example/example.go
    • Reordered import statements.
  • pkg/rpc/server/da_visualization.go
    • Reordered import statements.
  • pkg/rpc/server/da_visualization_test.go
    • Reordered import statements.
  • pkg/rpc/server/http.go
    • Reordered import statements.
  • pkg/rpc/server/http_test.go
    • Reordered import statements.
  • pkg/rpc/server/server.go
    • Reordered import statements.
  • pkg/sequencers/single/queue.go
    • Reordered import statements.
  • pkg/sequencers/single/sequencer_test.go
    • Reordered import statements.
  • pkg/sync/sync_service_test.go
    • Reordered import statements.
  • pkg/telemetry/executor_tracing.go
    • Reordered import statements.
  • pkg/telemetry/executor_tracing_test.go
    • Reordered import statements.
  • pkg/telemetry/sequencer_tracing.go
    • Reordered import statements.
  • pkg/telemetry/sequencer_tracing_test.go
    • Reordered import statements.
  • test/docker-e2e/compat_test.go
    • Reordered import statements.
  • test/docker-e2e/resiliency_test.go
    • Reordered import statements.
  • test/docker-e2e/upgrade_test.go
    • Reordered import statements.
  • test/e2e/base_test.go
    • Reordered import statements.
  • test/e2e/da_client_integration_test.go
    • Reordered import statements.
  • test/e2e/da_posting_integration_test.go
    • Reordered import statements.
  • test/e2e/evm_contract_bench_test.go
    • Reordered import statements.
  • test/e2e/evm_test_common.go
    • Reordered import statements.
  • test/e2e/failover_e2e_test.go
    • Reordered import statements.
  • test/mocks/height_aware_executor.go
    • Reordered import statements.
  • tools/da-debug/main.go
    • Reordered import statements.
  • tools/local-da/local.go
    • Reordered import statements.
Activity
  • No human activity (comments, reviews) has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request enables the gci formatter to enforce goimports-style import ordering and applies the formatting across the entire codebase. The vast majority of changes are import reordering, which improves code consistency. Additionally, there are a few minor but positive changes, such as using fmt.Appendf for better performance in a benchmark test and adopting more concise syntax for empty byte slices. The changes are correct and align with the goal of improving code style and maintainability. No issues were found.

@codecov
Copy link

codecov bot commented Feb 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.93%. Comparing base (ce18484) to head (a7cb7fb).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3096   +/-   ##
=======================================
  Coverage   60.92%   60.93%           
=======================================
  Files         113      113           
  Lines       11617    11617           
=======================================
+ Hits         7078     7079    +1     
+ Misses       3741     3739    -2     
- Partials      798      799    +1     
Flag Coverage Δ
combined 60.93% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants