• 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
..
asm Loading commit data...
buildtag Loading commit data...
cgo Loading commit data...
divergent Loading commit data...
incomplete Loading commit data...
tagtest Loading commit data...
testingpkg Loading commit data...
asm8.s Loading commit data...
assign.go Loading commit data...
atomic.go Loading commit data...
bool.go Loading commit data...
composite.go Loading commit data...
copylock.go Loading commit data...
copylock_func.go Loading commit data...
copylock_range.go Loading commit data...
deadcode.go Loading commit data...
httpresponse.go Loading commit data...
lostcancel.go Loading commit data...
method.go Loading commit data...
nilfunc.go Loading commit data...
print.go Loading commit data...
rangeloop.go Loading commit data...
shadow.go Loading commit data...
shift.go Loading commit data...
structtag.go Loading commit data...
unsafeptr.go Loading commit data...
unused.go Loading commit data...