unbed refactoring tool

150 views
Skip to first unread message

Matthew Dempsky

unread,
Apr 13, 2017, 5:01:40 PM4/13/17
to golang-dev
I wrote a tool to help with getting rid of struct embeddings: https://github.com/mdempsky/unbed

In my extensive testing (n=1), it appears to work: https://golang.org/cl/40670

Bug reports welcome.

cherry

unread,
Apr 13, 2017, 5:27:43 PM4/13/17
to Matthew Dempsky, golang-dev
What is the reason for getting rid of the embedding?

--
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Matthew Dempsky

unread,
Apr 13, 2017, 5:36:40 PM4/13/17
to cherry, golang-dev
On Thu, Apr 13, 2017 at 2:27 PM, cherry <luna...@gmail.com> wrote:
What is the reason for getting rid of the embedding?

Are you asking specifically about LSym.FuncInfo? If so, because only STEXT LSyms have a FuncInfo. By always writing s.Func.Foo instead of s.Foo, I think it's a bit clearer that s has to be STEXT.

When I first extracted FuncInfo out of LSym, I had to clean up some of the LSym printing routines because they were accessing s.Text, etc. even for non-STEXT LSyms, and the implicit field traversal led to nil pointer dereference panics.

cherry

unread,
Apr 13, 2017, 5:44:37 PM4/13/17
to Matthew Dempsky, golang-dev
On Thu, Apr 13, 2017 at 5:36 PM, Matthew Dempsky <mdem...@google.com> wrote:
On Thu, Apr 13, 2017 at 2:27 PM, cherry <luna...@gmail.com> wrote:
What is the reason for getting rid of the embedding?

Are you asking specifically about LSym.FuncInfo?

Yes. Thanks!

Reply all
Reply to author
Forward
0 new messages