You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
internal/config: replace TypeOf with TypeFor - #2360
Replaces the original TypeOf calls with the TypeFor call, which was introduced in Golang 1.22. This allows for compile time checking, rather than runtime checking with a dummy variable created in its place (for example, TypeOf("")). The new TypeFor calls TypeOf under the hood, but in a way that is easier to work with for interfaces.
No actionable comments were generated in the recent review.
Walkthrough
The changes replace reflect.TypeOf calls on zero-value instances with reflect.TypeFor in translation code, config checks, offline fetch logic, and tests. The reflected types and described checks remain unchanged.
Changes: Reflection type lookups
Layer / File(s)
Summary
Replace runtime type lookups butane/translate/translate.go, config/util/interfaces.go, internal/exec/stages/fetch_offline/fetch-offline.go
Runtime type lookups use reflect.TypeFor. The described checks and conversion behavior remain unchanged.
Update config type checks and translation tests config/config_test.go, config/v3_*/translate/translate_test.go, config/v3_7_experimental/translate/translate_test.go, docs/release-notes.d/reflect-typefor.change.md
Config structural checks and translation tests use reflect.TypeFor. The release note describes the replacements.
coreos/ignition#2353 — The PR adds a release-note fragment, matching the workflow described by this issue.
Suggested reviewers:prestist
Merge Risk: Minimal · up to 0e70f
The type lookup changes introduce no identified merge-blocking risk.
Pre-merge checks: 6
Check name
Status
Explanation
Title check
The title follows the required format. It uses the subsystem prefix "internal/config:", a lowercase imperative description, and has no trailing period. It accurately describes the TypeOf-to-TypeFor ch…
Docstring Coverage
Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentati…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Commit Message Convention
The PR has one non-merge commit: internal/config: replace TypeOf with TypeFor. Its subject follows the required format.
Description check
The description states the PR replaces TypeOf calls with reflect.TypeFor (Go 1.22). This matches the raw summary, which lists the changed files and the reflect.TypeFor substitutions. The description a…
Full details: Title check
Explanation
The title follows the required format. It uses the subsystem prefix "internal/config:", a lowercase imperative description, and has no trailing period. It accurately describes the TypeOf-to-TypeFor changes.
Full details: Docstring Coverage
Explanation
Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 5 functions across 11 files. (1 skipped: 1 unsupported.)
Full details: Description check
Explanation
The description states the PR replaces TypeOf calls with reflect.TypeFor (Go 1.22). This matches the raw summary, which lists the changed files and the reflect.TypeFor substitutions. The description also gives the motivation and the CI go fix count of 24 instances. It is on-topic and specific, so the check passes.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Reviewing files that changed from the base of the PR and between b3e3422 and 0e70f84.
Files selected for processing: 1
docs/release-notes.d/reflect-typefor.change.md
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.
systemd[1]: kola-runext.service: The kernel OOM killer killed some processes in this unit.
I see this is failing across other PRs too so I assume @prestist is looking into it.
This branch has not been deployed
No deployments
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
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.
Replaces the original
TypeOfcalls with theTypeForcall, which was introduced in Golang 1.22. This allows for compile time checking, rather than runtime checking with a dummy variable created in its place (for example,TypeOf("")). The newTypeForcallsTypeOfunder the hood, but in a way that is easier to work with for interfaces.There are 24 instances of these in the
go fixoutput of the ci pipeline. A link to the first one is here:https://github.com/coreos/ignition/actions/runs/42288477470/job/128135379929#step:7:14
References: