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

Unexported struct fields which are pointers are not deep copied #212

Open
anandsunderraman opened this issue May 27, 2024 · 0 comments
Open
Assignees

Comments

@anandsunderraman
Copy link

Reproducible Example

https://go.dev/play/p/xa2-zmGBrU9

Description

Refer to the example above.

type Address struct {
	Street string
	City   string
}

type Person struct {
	Name string
	Age  int
	addr *Address
}

If a struct has an unexported field and if it is a pointer then DeepCopy of this unexported pointer does not happen.

@anandsunderraman anandsunderraman changed the title Unexported fields are not deep copied Unexported struct fields which are pointers are not deep copied May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants