Skip to content

code-generator/applyconfiguration-gen: Embedding imported Type results in <.EmbeddedIn.MemberType.Elem.Name.Name>: nil pointer evaluating *types.Type.Name #131533

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

Closed
shashankram opened this issue Apr 29, 2025 · 5 comments · Fixed by #131628
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@shashankram
Copy link

shashankram commented Apr 29, 2025

Using applyconfiguration-gen with the following type produces an error

import (
        gwv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
)

type Status struct {
	gwv1alpha2.PolicyStatus `json:",inline"`
}
F0424 08:57:02.343886 1766244 main.go:57] Error: failed executing generator: some targets had errors: template: /home/shashank/.gvm/pkgsets/go1.24.1/global/pkg/mod/k8s.io/code-generator@v0.32.2/cmd/applyconfiguration-gen/generators/applyconfiguration.go:342:1:37: executing "/home/shashank/.gvm/pkgsets/go1.24.1/global/pkg/mod/k8s.io/code-generator@v0.32.2/cmd/applyconfiguration-gen/generators/applyconfiguration.go:342" at <.EmbeddedIn.MemberType.Elem.Name.Name>: nil pointer evaluating *types.Type.Name

Not embedding the field works:

type Status struct {
	PolicyStatus gwv1alpha2.PolicyStatus `json:",inline"`
}

Also confirmed that Embedding local types works fine, but not for an imported type.

This is with k8s.io/code-generator v0.32.3

To reproduce:

@k8s-ci-robot k8s-ci-robot added needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Apr 29, 2025
@shashankram shashankram changed the title code-generator: Embedding a field results in <.EmbeddedIn.MemberType.Elem.Name.Name>: nil pointer evaluating *types.Type.Name code-generator/applyconfiguration-gen: Embedding a field results in <.EmbeddedIn.MemberType.Elem.Name.Name>: nil pointer evaluating *types.Type.Name Apr 29, 2025
@shashankram
Copy link
Author

/sig api-machinery

@k8s-ci-robot k8s-ci-robot added sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Apr 29, 2025
@shashankram
Copy link
Author

cc @skitt

@BenTheElder
Copy link
Member

@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Apr 29, 2025
@shashankram shashankram changed the title code-generator/applyconfiguration-gen: Embedding a field results in <.EmbeddedIn.MemberType.Elem.Name.Name>: nil pointer evaluating *types.Type.Name code-generator/applyconfiguration-gen: Embedding a imported Type results in <.EmbeddedIn.MemberType.Elem.Name.Name>: nil pointer evaluating *types.Type.Name May 1, 2025
@shashankram shashankram changed the title code-generator/applyconfiguration-gen: Embedding a imported Type results in <.EmbeddedIn.MemberType.Elem.Name.Name>: nil pointer evaluating *types.Type.Name code-generator/applyconfiguration-gen: Embedding imported Type results in <.EmbeddedIn.MemberType.Elem.Name.Name>: nil pointer evaluating *types.Type.Name May 1, 2025
@yongruilin
Copy link
Contributor

/cc @Jefftree
/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels May 1, 2025
@skitt
Copy link
Member

skitt commented May 5, 2025

/assign

skitt added a commit to skitt/kubernetes that referenced this issue May 6, 2025
This is based on the reproducer for
kubernetes#131533.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
skitt added a commit to skitt/kubernetes that referenced this issue May 6, 2025
This is based on the reproducer for
kubernetes#131533.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
skitt added a commit to skitt/kubernetes that referenced this issue May 14, 2025
This is based on the reproducer for
kubernetes#131533.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
k8s-publishing-bot pushed a commit to kubernetes/code-generator that referenced this issue May 20, 2025
This is based on the reproducer for
kubernetes/kubernetes#131533.

Signed-off-by: Stephen Kitt <skitt@redhat.com>

Kubernetes-commit: c374ab81185e59a4c3a7584c597917bf9dcc20ca
joshjms pushed a commit to joshjms/kubernetes that referenced this issue May 26, 2025
This is based on the reproducer for
kubernetes#131533.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy