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

fix: correctly resolve fields of aliased structs #1679

Merged
merged 3 commits into from
Jan 8, 2025

Conversation

secDre4mer
Copy link
Contributor

@secDre4mer secDre4mer commented Jan 7, 2025

Fields of types that are aliases are not always resolved correctly, especially if the aliased type is itself an alias.

A minimal example is:

package main

type original struct {
	Field string
}

func main() {
	type alias original
	type alias2 alias
	var a = &alias2{
		Field: "test",
	}
	println(a.Field)
}

There is already a method (baseType) for resolving the underlying struct type; but it isn't always used previous to this change.

Copy link
Member

@mvertes mvertes left a comment

Choose a reason for hiding this comment

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

Looks good to me

@mvertes mvertes merged commit f616581 into traefik:master Jan 8, 2025
12 checks passed
@mvertes mvertes added bug Something isn't working area/core labels Jan 8, 2025
@mvertes mvertes added this to the v0.16.x milestone Jan 8, 2025
@secDre4mer secDre4mer deleted the fix/linked-field-usage branch January 8, 2025 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants