• Daniel Martí's avatar
    cmd/vet: don't warn on escaped newlines in Println · 366681cc
    Daniel Martí authored
    The old code only worked for double-quoted strings, and only checked
    that the end of the literal value was \n". This worked most of the time,
    except for some strings like "foo\\n", which doesn't actually translate
    into a trailing newline when unquoted.
    
    To fix this, unquote the string first and look for a real newline at the
    end of it. Ignore errors, as we don't have anything to do with string
    literals using back quotes.
    
    Fixes #22613.
    
    Change-Id: I7cf96916dd578b7068216c2051ec2622cce0b740
    Reviewed-on: https://go-review.googlesource.com/76194
    Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
    366681cc
Name
Last commit
Last update
..
all Loading commit data...
internal Loading commit data...
testdata Loading commit data...
README Loading commit data...
asmdecl.go Loading commit data...
assign.go Loading commit data...
atomic.go Loading commit data...
bool.go Loading commit data...
buildtag.go Loading commit data...
cgo.go Loading commit data...
composite.go Loading commit data...
copylock.go Loading commit data...
dead.go Loading commit data...
deadcode.go Loading commit data...
doc.go Loading commit data...
httpresponse.go Loading commit data...
lostcancel.go Loading commit data...
main.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...
tests.go Loading commit data...
types.go Loading commit data...
unsafeptr.go Loading commit data...
unused.go Loading commit data...
vet_test.go Loading commit data...