You need to sign in or sign up before continuing.
  • Daniel Martí's avatar
    cmd/vet: fix some pointer false positives in printf · edb2d1cb
    Daniel Martí authored
    fmt's godoc reads:
    
    	For compound objects, the elements are printed using these
    	rules, recursively, laid out like this:
    
    		struct:             {field0 field1 ...}
    		array, slice:       [elem0 elem1 ...]
    		maps:               map[key1:value1 key2:value2 ...]
    		pointer to above:   &{}, &[], &map[]
    
    That is, a pointer to a struct, array, slice, or map, can be correctly
    printed by fmt if the type pointed to can be printed without issues.
    
    vet was only following this rule for pointers to structs, omitting
    arrays, slices, and maps. Fix that, and add tests for all the
    combinations.
    
    Updates #27672.
    
    Change-Id: Ie61ebe1fffc594184f7b24d7dbf72d7d5de78309
    Reviewed-on: https://go-review.googlesource.com/c/147758
    
    
    Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: default avatarAlan Donovan <adonovan@google.com>
    edb2d1cb
print.go 27.1 KB