Repository navigation
chore(lint): enforce Go import grouping and named imports - #223
Merged
Merged
Conversation
Enable the gci formatter in .golangci.yml with the shared section order adapted to this module: standard, github.com/onsi (ginkgo/gomega), third-party, github.com/inference-gateway/, then this module. Existing files were reformatted once; the multi-line comment above the blank client-auth import in cmd/main.go became a trailing comment because gci and goimports disagree on where comment-attached imports sort.
edenreich
commented
Sep 16, 2026
Enable importas so every non-standard-library import is named. Two regex rules keep the kubebuilder convention for versioned k8s API packages (corev1, appsv1, metav1); a catch-all derives every other alias from the last path element. The conventional ctrl, apierrors, utilruntime, clientgoscheme, gwapiv1 and corev1alpha1 aliases are pinned because the derived names collide or are meaningless (runtime, errors, apis). The inconsistent apiErrors alias is unified to apierrors. controller-gen and the providers generator were re-run: no drift.
3 tasks done
inference-gateway-releaser Bot
added a commit
that referenced
this pull request
Sep 24, 2026
## [0.25.1](v0.25.0...v0.25.1) (2026-09-24) ### ♻️ Improvements * **gateway:** render MCP_SERVERS as name=url aliases ([#236](#236)) ([3bfb7ac](3bfb7ac)) ### 👷 CI * **claude:** centralize claude.yml via reusable workflow ([#232](#232)) ([4d2a583](4d2a583)) * **deps:** bump github.com/onsi/ginkgo/v2 in the gomod group ([#218](#218)) ([5eb52ff](5eb52ff)) * **deps:** bump go.opentelemetry.io/otel/exporters/otlp/otlptrace ([#225](#225)) ([e681bae](e681bae)) * **deps:** bump go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc ([#227](#227)) ([5674492](5674492)) * **deps:** bump rancher/k3s from v1.36.4-k3s1 to v1.37.0-k3s1 in the docker group ([#228](#228)) ([343e738](343e738)) * **deps:** bump rancher/k3s in the docker group ([#219](#219)) ([50089f7](50089f7)) * **deps:** bump the gomod group with 3 updates ([#229](#229)) ([e016a01](e016a01)) ### 📚 Documentation * Document pre-commit hook and coverage command in AGENTS.md ([#224](#224)) ([aebbec0](aebbec0)) ### 🔧 Miscellaneous * **deps:** bump claude-code 2.1.245 -> 2.1.266 ([#220](#220)) ([09b15b8](09b15b8)) * **deps:** bump claude-code 2.1.266 -> 2.1.278 ([#230](#230)) ([114a61e](114a61e)) * **deps:** bump infer CLI v0.183.0 -> v0.192.0 ([#221](#221)) ([5186c52](5186c52)) * **deps:** bump infer CLI v0.192.0 -> v0.205.3 ([#231](#231)) ([099c939](099c939)) * **lint:** enforce Go import grouping and named imports ([#223](#223)) ([7ae0d6d](7ae0d6d))
Contributor
|
🎉 This PR is included in version 0.25.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #222
Summary
Enables the
gciformatter with the shared section order frominference-gateway/cli, adapted to this module, plusimportasso every non-standard-library import is explicitly named (same approach as inference-gateway/inference-gateway#667, inference-gateway/sdk#182, inference-gateway/adk#307). Existing files were reformatted once somainis green after the check lands.Changes
.golangci.yml: enablegciwithcustom-order: trueand sectionsstandard,prefix(github.com/onsi)(ginkgo/gomega),default,prefix(github.com/inference-gateway/),prefix(github.com/inference-gateway/operator).golangci.yml: enableimportaswithno-unaliased: true. Two regex rules keep the kubebuilder convention for versioned API packages (k8s.io/api/core/v1→corev1,apimachinery/pkg/apis/meta/v1→metav1); a catch-all derives every other alias from the last path element. Six conventional aliases are pinned because the derived name collides or is meaningless:ctrl,apierrors,utilruntime,clientgoscheme,gwapiv1,corev1alpha1golangci-lint fmt/golangci-lint run --fix; the inconsistentapiErrorsalias is unified toapierrors. Generated files (zz_generated*) stay untouched viagenerated: laxcmd/main.go: the two-line comment above the blankclient-go/plugin/pkg/client/authimport became a trailing comment; gci and goimports disagree on where a comment-attached import sortsVerification
task generate,task manifestsandtask generate:providersre-run: no drift inzz_generated*orconfig/task test(envtest) passesgolangci-lint runreports only the pre-existing staticcheck finding onmain(ctrl.Result{Requeue: true}is deprecated), unrelated to this changeNotes
CI already runs
task linton every PR, so both checks are enforced with no workflow change.