Skip to content

chore(lint): enforce Go import grouping and named imports - #417

Merged
edenreich merged 1 commit into
mainfrom
fix/issue-416
Sep 16, 2026
Merged

edenreich merged 1 commit into
mainfrom
fix/issue-416

Conversation

@edenreich

Copy link
Copy Markdown
Contributor

Resolves #416

Summary

Adds a golangci-lint v2 config that enforces the shared import layout from inference-gateway/cli, adapted to this module, plus a naming rule so every non-standard-library import is explicitly aliased (same approach as inference-gateway/inference-gateway#667 and inference-gateway/sdk#182).

Changes

  • .golangci.yml (new): enable gci with custom-order: true and sections standard, prefix(github.com/stretchr/testify), default, prefix(github.com/inference-gateway/) (covers inference-gateway/adk), prefix(github.com/inference-gateway/adl-cli)
  • .golangci.yml: enable importas with no-unaliased: true and a catch-all regex that derives the alias from the last path element. This repo needs no per-package pins.
  • Reformat existing files once (golangci-lint fmt / golangci-lint run --fix); generated files (internal/schema/types.go, internal/templates/headers.go) stay untouched via generated: lax
  • Document the import order, the naming rule, and the local fix commands in AGENTS.md and CONTRIBUTING.md

Notes

  • CI already runs golangci-lint run on every PR, so the check is enforced with no workflow change.
  • The issue's bonus idea, shipping the same config through the generated agent CI template, is not part of this PR. Generated agent repos have their own module paths and import sets, so the config would need templating; happy to do that as a follow-up if wanted.

Add a golangci-lint v2 config that enables the gci formatter with the
shared section order adapted to this module (standard, testify,
third-party, github.com/inference-gateway/, this module) and importas
with a catch-all rule so every non-standard-library import is named
after its last path element. No per-package pins are needed in this
repo. Existing files were reformatted once; generated files stay
untouched.
@edenreich
edenreich requested a review from a team as a code owner September 16, 2026 14:32
@edenreich
edenreich merged commit c64fa23 into main Sep 16, 2026
1 check passed
@edenreich
edenreich deleted the fix/issue-416 branch September 16, 2026 14:36
inference-gateway-releaser Bot added a commit that referenced this pull request Sep 17, 2026
## [0.63.4](v0.63.3...v0.63.4) (2026-09-17)

### 🔧 Miscellaneous

* **deps:** bump DeterminateSystems/nix-installer-action ([#419](#419)) ([ababe8f](ababe8f))
* **deps:** bump golang.org/x/term in the gomod group ([#418](#418)) ([9b7e179](9b7e179))
* **deps:** bump template pins from agent dependabot PRs ([#420](#420)) ([7d20ad4](7d20ad4))
* **deps:** bump template pins to latest ([#423](#423)) ([8b01295](8b01295))
* **lint:** enforce Go import grouping and named imports ([#417](#417)) ([c64fa23](c64fa23))

### ✅ Miscellaneous

* read template pins from vendor maps instead of hardcoding ([#421](#421)) ([a4eda21](a4eda21))
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.63.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the released Shipped in a release label Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Enforce Go import order with gci in golangci-lint

1 participant