• Rob Pike's avatar
    cmd/go: avoid use of bufio.Scanner in generate · dd26fc38
    Rob Pike authored
    Scanner can't handle stupid long lines and there are
    reports of stupid long lines in production.
    
    Note the issue isn't long "//go:generate" lines, but
    any long line in any Go source file.
    
    To be fair, if you're going to have a stupid long line
    it's not a bad bet you'll want to run it through go
    generate, because it's some embeddable asset that
    has been machine generated. (One could ask why
    that generation process didn't add a newline or two,
    but we should cope anyway.)
    
    Rewrite the file scanner in "go generate" so it can
    handle arbitrarily long lines, and only stores in memory
    those lines that start "//go:generate".
    
    Also: Adjust the documentation to make clear that it
    does not parse the file.
    
    Fixes #9143.
    Fixes #9196.
    
    LGTM=rsc, dominik.honnef
    R=rsc, cespare, minux, dominik.honnef
    CC=golang-codereviews
    https://golang.org/cl/182970043
    dd26fc38
Name
Last commit
Last update
api Loading commit data...
doc Loading commit data...
include Loading commit data...
lib Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.hgignore Loading commit data...
.hgtags Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...