]> Cypherpunks repositories - gostls13.git/commitdiff
go/format: quote bytes in comments for readability
authorxufei_Alex <badgangkiller@gmail.com>
Mon, 17 Apr 2017 01:57:59 +0000 (01:57 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Wed, 19 Apr 2017 06:19:17 +0000 (06:19 +0000)
Change-Id: I8e90012b3498c51aaeb2f70182debab52549afb4
Reviewed-on: https://go-review.googlesource.com/40930
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/go/format/internal.go

index b8b470da8bb1bd5d6d286c3d5aeee80866cccee2..4918681de57c217505644cfbc6161f2f03557b76 100644 (file)
@@ -37,14 +37,14 @@ func parse(fset *token.FileSet, filename string, src []byte, fragmentOk bool) (
 
        // If this is a declaration list, make it a source file
        // by inserting a package clause.
-       // Insert using a ;, not a newline, so that the line numbers
+       // Insert using a ';', not a newline, so that the line numbers
        // in psrc match the ones in src.
        psrc := append([]byte("package p;"), src...)
        file, err = parser.ParseFile(fset, filename, psrc, parserMode)
        if err == nil {
                sourceAdj = func(src []byte, indent int) []byte {
                        // Remove the package clause.
-                       // Gofmt has turned the ; into a \n.
+                       // Gofmt has turned the ';' into a '\n'.
                        src = src[indent+len("package p\n"):]
                        return bytes.TrimSpace(src)
                }
@@ -60,7 +60,7 @@ func parse(fset *token.FileSet, filename string, src []byte, fragmentOk bool) (
        // If this is a statement list, make it a source file
        // by inserting a package clause and turning the list
        // into a function body. This handles expressions too.
-       // Insert using a ;, not a newline, so that the line numbers
+       // Insert using a ';', not a newline, so that the line numbers
        // in fsrc match the ones in src. Add an extra '\n' before the '}'
        // to make sure comments are flushed before the '}'.
        fsrc := append(append([]byte("package p; func _() {"), src...), '\n', '\n', '}')
@@ -72,7 +72,7 @@ func parse(fset *token.FileSet, filename string, src []byte, fragmentOk bool) (
                                indent = 0
                        }
                        // Remove the wrapping.
-                       // Gofmt has turned the ; into a \n\n.
+                       // Gofmt has turned the ';' into a '\n'.
                        // There will be two non-blank lines with indent, hence 2*indent.
                        src = src[2*indent+len("package p\n\nfunc _() {"):]
                        // Remove only the "}\n" suffix: remaining whitespaces will be trimmed anyway