• Daniel Martí's avatar
    cmd/vet: warn on unkeyed struct pointer literals · 6ded116a
    Daniel Martí authored
    We did warn on them in some cases, but not others. In particular, if one
    used a slice composite literal with struct pointer elements, and omitted
    the type of an element's composite literal, it would not get any warning
    even if it should get one.
    
    The issue is that typ.Underlying() can be of type *types.Pointer. Skip
    those levels of indirection before checking for a *types.Struct
    underlying type.
    
    isLocalType also needed a bit of tweaking to ignore dereferences.
    Perhaps that can be rewritten now that we have type info, but let's
    leave it for another time.
    
    Fixes #23539.
    
    Change-Id: I727a497284df1325b70d47a756519f5db1add25d
    Reviewed-on: https://go-review.googlesource.com/89715
    Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
    6ded116a
Name
Last commit
Last update
.github Loading commit data...
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...