TGViewer
Go Go @golang · 19.2K subscribers
Post #162 30K
Be Careful with Go Struct Embedding

Embedding structs can quietly mask deeper-nested fields: a duplicate field name isn’t ambiguous unless it appears at the same ‘depth’, meaning your program may choose an unintended value.

https://mattjhall.co.uk/posts/be-careful-with-go-struct-embedding.html
mattjhall.co.uk Be Careful with Go Struct Embedding - Matt Hall The gophers nested too greedily and too deep.
  • 👍 98
  • 🔥 30
  • ❤ 25
  • 👎 24
  • 🤔 24
  • 👏 19
  • 💩 18
  • 🤯 15
More from @golang
  1. Oct 1, 2026It's been a while... Everything is going agentic, so there is rather an interesting projec…
  2. Mar 20, 2026If you’re working with Go and care about performance, then check out the https://goperf.de…
  3. Jan 17, 2026Are Atomic Operations Faster and Better Than a Mutex? It Depends From the author: "Recentl…
  4. Nov 29, 2025Hello, folks, it's been a while. Re-sharing an interetsting recording from GopherCon 2025:…
  5. May 31, 2025What's new in Go: Google I/O presentation https://www.youtube.com/watch?v=kj80m-umOxs&ab_c…
  6. Feb 9, 2025Go 1.24: A Major Improvement for Tooling: go tools 🛠 Hello, folks! The upcoming Go 1.24 (…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →