Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/vet: warn on unkeyed struct pointer literals
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 golang#23539. Change-Id: I727a497284df1325b70d47a756519f5db1add25d Reviewed-on: https://go-review.googlesource.com/89715 Run-TryBot: Daniel Martí <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
- Loading branch information