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

Add goimports #415

Closed
wants to merge 3 commits into from
Closed

Add goimports #415

wants to merge 3 commits into from

Conversation

mikenairn
Copy link
Member

Something we added to MGC a while back which i think would be good here Kuadrant/multicluster-gateway-controller#365

Adds new Make targets to sort and group project imports make imports and verify imports are sorted and grouped make verify-imports.

make help | grep imports
  imports          Run openshift goimports against code.
  verify-imports   Verify go imports are sorted and grouped correctly.
  openshift-goimports  Download openshift-goimports locally if necessary

Sorting and grouping based on openshift-goimports defaults, with all kuadrant* modules added as an intermediate so they get grouped nearer the modules imports. Script inspired by KCP and other openshift projects.

From openshift-goimports docs:

Organizes Go imports into the following groups:
  
  standard - Any of the Go standard library packages
  other - Anything not specifically called out in this list
  kubernetes - Anything that starts with k8s.io
  openshift - Anything that starts with github.com/openshift
  intermediates - Optional list of groups
  module - Anything that is part of the current module

Also adds job to CI GH action to execute the verify-imports command on all PRs.

@mikenairn mikenairn requested a review from a team as a code owner February 7, 2024 21:13
Copy link

codecov bot commented Feb 7, 2024

Codecov Report

Merging #415 (d0182ac) into main (133645e) will not change coverage.
The diff coverage is n/a.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #415   +/-   ##
=======================================
  Coverage   66.26%   66.26%           
=======================================
  Files          38       38           
  Lines        3901     3901           
=======================================
  Hits         2585     2585           
  Misses       1129     1129           
  Partials      187      187           
Flag Coverage Δ
unit 60.69% <ø> (ø)

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

Components Coverage Δ
api/v1beta1 (u) ∅ <ø> (∅)
pkg/common (u) 78.59% <ø> (ø)
pkg/istio (u) 37.11% <ø> (ø)
pkg/log (u) 31.81% <ø> (ø)
pkg/reconcilers (u) 33.44% <ø> (ø)
pkg/rlptools (u) 56.46% <ø> (ø)
controllers (i) 71.39% <ø> (ø)
Files Coverage Δ
api/v1beta2/authpolicy_types.go 70.83% <ø> (ø)
api/v1beta2/ratelimitpolicy_types.go 17.24% <ø> (ø)
api/v1beta2/route_selectors.go 100.00% <ø> (ø)
controllers/authpolicy_authconfig.go 66.31% <ø> (ø)
controllers/authpolicy_controller.go 78.66% <ø> (ø)
...ontrollers/authpolicy_istio_authorizationpolicy.go 74.42% <ø> (ø)
controllers/authpolicy_status.go 93.44% <ø> (ø)
controllers/gateway_eventmapper.go 80.95% <ø> (ø)
controllers/gateway_kuadrant_controller.go 79.71% <ø> (ø)
controllers/httproute_eventmapper.go 100.00% <ø> (ø)
... and 19 more

Adds new Make targets to sort and group project imports `make imports`
and verify imports are sorted and grouped `make verify-imports`. Sorting
and grouping based on openshift-goimports defaults see
https://github.com/openshift-eng/openshift-goimports, with all
kuadrant imports added as an intermediate so they are grouped nearer the
modules imports.
@mikenairn
Copy link
Member Author

CI already has a check using goimports so closing this for now

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.

1 participant