Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Order dependency imports #426

Closed
KevFan opened this issue Feb 16, 2024 · 1 comment · Fixed by #615
Closed

Order dependency imports #426

KevFan opened this issue Feb 16, 2024 · 1 comment · Fixed by #615
Assignees
Labels
kind/enhancement New feature or request

Comments

@KevFan
Copy link
Contributor

KevFan commented Feb 16, 2024

Driven by the conversation at #411 (comment), there are a few inconsitencies in a few places regarding the import order and grouping of dependencies.

The ask of this issue is to address and look into potential solutions to ensure a consitent order / grouping to depenendencies across the files.

@KevFan KevFan added the kind/enhancement New feature or request label Feb 16, 2024
@eguzki
Copy link
Contributor

eguzki commented Feb 16, 2024

This is my own personal taste:

Three groups:

  • Top: Golang standard library packages
  • Middle: Third party library packages
  • Bottom: current module's packages

For example

import (                                                                        
    "context"                                                                   
    "encoding/json"                                                             
                                                                                
    "github.com/go-logr/logr"                                                   
    apierrors "k8s.io/apimachinery/pkg/api/errors"                              
    ctrl "sigs.k8s.io/controller-runtime"                                       
    "sigs.k8s.io/controller-runtime/pkg/client"                                 
    "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"              
    "sigs.k8s.io/controller-runtime/pkg/handler"                                
    gatewayapiv1 "sigs.k8s.io/gateway-api/apis/v1"                              
                                                                                
    kuadrantv1beta2 "github.com/kuadrant/kuadrant-operator/api/v1beta2"         
    "github.com/kuadrant/kuadrant-operator/pkg/common"                          
    "github.com/kuadrant/kuadrant-operator/pkg/reconcilers"                     
)                                                                               

goimport orders your imports alphabetically and also maintains any groupings you make

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants