Skip to content

Modernize #6118

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 8 commits into from
Apr 10, 2025
Merged

Modernize #6118

merged 8 commits into from
Apr 10, 2025

Conversation

kolyshkin
Copy link
Contributor

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

Converts the code to use various Go 1.23+ features:

  • any instead of interface{} (available since Go 1.18);
  • for range over integers (available since Go 1.22, https://tip.golang.org/ref/spec#For_range)
  • use various slices and maps methods more, where appropriate (Go 1.21...1.23)
  • a couple of minor fixes/cleanups

Please see individual commit for details.

Mostly found by modernize.

How to verify it

Existing tests should be adequate.

Which issue(s) this PR fixes:

None

Special notes for your reviewer:

Does this PR introduce a user-facing change?

NONE

Brought to you by

	gofmt -r 'interface{} -> any' -w .

Signed-off-by: Kir Kolyshkin <[email protected]>
A slice returned by os.Environ is a already a brand new copy, no need to
copy it again.

Signed-off-by: Kir Kolyshkin <[email protected]>
Available since Go 1.22 (see https://tip.golang.org/ref/spec#For_range).

Signed-off-by: Kir Kolyshkin <[email protected]>
@openshift-ci openshift-ci bot added do-not-merge/work-in-progress kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. labels Apr 8, 2025
Copy link

Ephemeral COPR build failed. @containers/packit-build please check.

@kolyshkin kolyshkin marked this pull request as ready for review April 8, 2025 17:53
Copy link
Member

@nalind nalind left a comment

Choose a reason for hiding this comment

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

LGTM, except for a second "import" being added to a source file.

@openshift-ci openshift-ci bot added the approved label Apr 8, 2025
Signed-off-by: Kir Kolyshkin <[email protected]>
Signed-off-by: Kir Kolyshkin <[email protected]>
Signed-off-by: Kir Kolyshkin <[email protected]>
Signed-off-by: Kir Kolyshkin <[email protected]>
No functionality change, just code simplification.

Covered by existing test (e.g. "run should also override /etc/hostname"
in tests/run.bats).

NO NEW TESTS NEEDED

Signed-off-by: Kir Kolyshkin <[email protected]>
Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

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

/lgtm

Copy link
Contributor

openshift-ci bot commented Apr 10, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kolyshkin, Luap99, nalind

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-merge-bot openshift-merge-bot bot merged commit 5367a71 into containers:main Apr 10, 2025
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants