On Thursday, February 22, 2018 at 3:58:25 PM UTC-6, Devon H. O'Dell wrote:
>
> Thanks for pointing this out; I wasn't aware of this new syntax. I
> think this gets to about halfway of what I'd hope for. That said, I'd
> really like to avoid needing to jump through the hoop of indirection
> for this.
For what its worth, I solve this kind of update problem similarly.
Typically I
define a new struct type, then plug in a
pointer to the new struct struct as the map value or function argument that
will be added-to. I don't bother with fancy aliasing.
> I occasionally find it hard to recognize what the type of a
> thing is due to heavy use of type inference, so I'd hope for something
> that doesn't require me to do additional backtracking to figure out
> what the real underlying type is.
>
For the 0.1% of situations where fmt.Printf("T%", unknown) or
fmt.Printf("%#v", unknown) do not
suffice, I find https://github.com/shurcooL/go-goon quite useful, and a
goon.Dump(unknown)
informative.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.