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

x/tools/gopls: support fillstruct for anonymous structs #39803

Closed
stamblerre opened this issue Jun 24, 2020 · 2 comments
Closed

x/tools/gopls: support fillstruct for anonymous structs #39803

stamblerre opened this issue Jun 24, 2020 · 2 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.

Comments

@stamblerre
Copy link
Contributor

The fix needs to be made in the analysisinternal package: https://github.com/golang/tools/blob/master/internal/analysisinternal/analysis.go#L110.

/cc @joshbaum

@stamblerre stamblerre added this to the gopls/v0.5.0 milestone Jun 24, 2020
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Jun 24, 2020
@stamblerre stamblerre removed this from the gopls/v0.5.0 milestone Jun 24, 2020
@dnwe
Copy link

dnwe commented Jun 29, 2020

RE: the original placeholder comment "// TODO: anonymous structs, but who does that"

This may already be well known, but the one place where that is key is when you're filling a slice of some struct:

ss := &appsv1.StatefulSet{
	Spec: appsv1.StatefulSetSpec{
		Template: v1.PodTemplateSpec{
			Spec: v1.PodSpec{
				Containers: []v1.Container{
					{},
				},
			},
		},
	},
}

Currently you'd have to add the redundant v1.Container in front of the {} to allow you to call the fillstruct codeaction, and then remove the redundant v1.Container afterwards

@gopherbot
Copy link

Change https://golang.org/cl/240463 mentions this issue: internal/lsp/analysis/fillstruct: permit anonymous structs to be filled

@golang golang locked and limited conversation to collaborators Jul 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

4 participants