Skip to content

OCPBUGS-43157: update goimports targets #370

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

Merged
merged 1 commit into from
Oct 15, 2024

Conversation

elmiko
Copy link
Contributor

@elmiko elmiko commented Oct 15, 2024

This change removes the old goimports command execution in favor of using the golangci-lint configuration to include goimports. The fmt target is also updated to use the normal go fmt command.

@openshift-ci-robot openshift-ci-robot added jira/severity-moderate Referenced Jira bug's severity is moderate for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. labels Oct 15, 2024
@openshift-ci-robot
Copy link

@elmiko: This pull request references Jira Issue OCPBUGS-43157, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.18.0) matches configured target version for branch (4.18.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @sunzhaohua2

The bug has been updated to refer to the pull request using the external bug tracker.

In response to this:

This change removes the old goimports command execution in favor of using the golangci-lint configuration to include goimports. The fmt target is also updated to use the normal go fmt command.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot requested review from sunzhaohua2, nrb and sub-mod October 15, 2024 16:05
@elmiko
Copy link
Contributor Author

elmiko commented Oct 15, 2024

/cherry-pick release-4.17

@openshift-cherrypick-robot

@elmiko: once the present PR merges, I will cherry-pick it on top of release-4.17 in a new PR and assign it to you.

In response to this:

/cherry-pick release-4.17

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@@ -69,7 +69,7 @@ vet:
# Run golangci-lint against code
.PHONY: lint
lint:
( GOLANGCI_LINT_CACHE=$(PROJECT_DIR)/.cache $(GOLANGCI_LINT) run --timeout 10m )
( GOLANGCI_LINT_CACHE=$(PROJECT_DIR)/.cache $(GOLANGCI_LINT) run --timeout 10m -v)
Copy link
Contributor

Choose a reason for hiding this comment

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

Given we had this before, and there was no config file, does that mean it was just running with the default linters?

I'm concerned that adding a config with just the one linter is now disabling the default linters, can you please check?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i did check, and yes we were running the 6 defaults and with this config it goes up to 7. terminal output attached

$ make lint                                                                                                                                             
( GOLANGCI_LINT_CACHE=/home/mike/dev/cluster-cloud-controller-manager-operator/.cache go run /home/mike/dev/cluster-cloud-controller-manager-operator/ve
ndor/github.com/golangci/golangci-lint/cmd/golangci-lint run --timeout 10m -v)                                                                          
INFO [config_reader] Config search paths: [./ /home/mike/dev/cluster-cloud-controller-manager-operator /home/mike/dev /home/mike /home /]               
INFO [lintersdb] Active 6 linters: [errcheck gosimple govet ineffassign staticcheck unused]                                                             
INFO [loader] Go packages loading at mode 575 (files|types_sizes|compiled_files|exports_file|name|deps|imports) took 254.169292ms                       
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 2.518242ms                                                                                 
INFO [linters_context/goanalysis] analyzers took 0s with no stages                                                                                      
INFO [runner] Issues before processing: 6, after processing: 0              
INFO [runner] Processors filtering stat (out/in): cgo: 6/6, path_prettifier: 6/6, skip_dirs: 6/6, exclude-rules: 1/6, filename_unadjuster: 6/6, autogene
rated_exclude: 6/6, skip_files: 6/6, identifier_marker: 6/6, exclude: 6/6, nolint: 0/1 
INFO [runner] processing took 778.124µs with stages: nolint: 632.408µs, identifier_marker: 42.244µs, autogenerated_exclude: 29.122µs, path_prettifier: 2
8.022µs, exclude-rules: 22.503µs, skip_dirs: 20.094µs, cgo: 1.103µs, max_same_issues: 446ns, fixer: 324ns, diff: 293ns, filename_unadjuster: 290ns, seve
rity-rules: 264ns, exclude: 221ns, uniq_by_line: 178ns, skip_files: 170ns, max_from_linter: 96ns, source_code: 80ns, sort_results: 75ns, path_shortener:
 70ns, max_per_file_from_linter: 64ns, path_prefixer: 57ns                  
INFO [runner] linters took 108.736888ms with stages: goanalysis_metalinter: 107.921807ms                                                                
INFO File cache stats: 0 entries of total size 0B                                                                                                       
INFO Memory: 5 samples, avg is 39.4MB, max is 67.2MB                                                                                                    
INFO Execution took 368.213838ms                                            
[mike@shift] update-fmt-and-imports ~/dev/cluster-cloud-controller-manager-operator                                                                     
$ vim .golangci.yaml                                                                                                                                    
[mike@shift] update-fmt-and-imports ~/dev/cluster-cloud-controller-manager-operator                                                                     
$ make lint                                                                 
( GOLANGCI_LINT_CACHE=/home/mike/dev/cluster-cloud-controller-manager-operator/.cache go run /home/mike/dev/cluster-cloud-controller-manager-operator/ve
ndor/github.com/golangci/golangci-lint/cmd/golangci-lint run --timeout 10m -v)   
INFO [config_reader] Config search paths: [./ /home/mike/dev/cluster-cloud-controller-manager-operator /home/mike/dev /home/mike /home /]               
INFO [config_reader] Used config file .golangci.yaml                        
INFO [lintersdb] Active 7 linters: [errcheck goimports gosimple govet ineffassign staticcheck unused] 
INFO [loader] Go packages loading at mode 575 (exports_file|imports|types_sizes|compiled_files|deps|files|name) took 279.585394ms 
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 3.498925ms                                                                                 
INFO [linters_context/goanalysis] analyzers took 1m54.742755847s with top 10 stages: buildir: 1m40.24997572s, nilness: 3.396365699s, fact_deprecated: 2.
163002325s, inspect: 2.147753962s, printf: 1.451514392s, fact_purity: 1.357569133s, ctrlflow: 1.328747476s, SA5012: 1.031048598s, typedness: 1.022998892
s, goimports: 78.306231ms                                                   
INFO [runner] Issues before processing: 6, after processing: 0                                                                                          
INFO [runner] Processors filtering stat (out/in): cgo: 6/6, path_prettifier: 6/6, identifier_marker: 6/6, filename_unadjuster: 6/6, skip_dirs: 6/6, auto
generated_exclude: 6/6, exclude: 6/6, exclude-rules: 1/6, nolint: 0/1, skip_files: 6/6 
INFO [runner] processing took 1.013784ms with stages: nolint: 786.051µs, identifier_marker: 64.982µs, autogenerated_exclude: 48.673µs, exclude-rules: 39
.219µs, path_prettifier: 39.024µs, skip_dirs: 31.36µs, cgo: 1.303µs, max_same_issues: 662ns, filename_unadjuster: 522ns, uniq_by_line: 271ns, fixer: 262
ns, skip_files: 247ns, diff: 204ns, sort_results: 191ns, source_code: 182ns, exclude: 182ns, severity-rules: 177ns, max_from_linter: 97ns, max_per_file_
from_linter: 66ns, path_shortener: 55ns, path_prefixer: 54ns                
INFO [runner] linters took 8.004349264s with stages: goanalysis_metalinter: 8.003284359s 
INFO File cache stats: 0 entries of total size 0B                           
INFO Memory: 82 samples, avg is 3258.7MB, max is 6761.6MB                   
INFO Execution took 8.290421183s                    

This change removes the old goimports command execution in favor of
using the golangci-lint configuration to include goimports. The fmt
target is also updated to use the normal `go fmt` command.
@elmiko elmiko force-pushed the update-fmt-and-imports branch from 0bae180 to f56cd8f Compare October 15, 2024 17:11
@elmiko
Copy link
Contributor Author

elmiko commented Oct 15, 2024

updated to add default linters in the configuration

@JoelSpeed
Copy link
Contributor

/lgtm
/approve

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 15, 2024
Copy link
Contributor

openshift-ci bot commented Oct 15, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JoelSpeed

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 15, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit 42446fc into openshift:master Oct 15, 2024
12 of 17 checks passed
@openshift-ci-robot
Copy link

@elmiko: Jira Issue OCPBUGS-43157: All pull requests linked via external trackers have merged:

Jira Issue OCPBUGS-43157 has been moved to the MODIFIED state.

In response to this:

This change removes the old goimports command execution in favor of using the golangci-lint configuration to include goimports. The fmt target is also updated to use the normal go fmt command.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

Copy link
Contributor

openshift-ci bot commented Oct 15, 2024

@elmiko: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-azure-ovn f56cd8f link false /test e2e-azure-ovn

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@openshift-cherrypick-robot

@elmiko: new pull request created: #371

In response to this:

/cherry-pick release-4.17

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-bot
Copy link

[ART PR BUILD NOTIFIER]

Distgit: ose-cluster-cloud-controller-manager-operator
This PR has been included in build ose-cluster-cloud-controller-manager-operator-container-v4.18.0-202410152241.p0.g42446fc.assembly.stream.el9.
All builds following this will include this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/severity-moderate Referenced Jira bug's severity is moderate for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants