From f859283324af6ddf9fdc75ef08ee42ae26bc581b Mon Sep 17 00:00:00 2001 From: Mateusz Poliwczak Date: Mon, 17 Jun 2024 18:46:27 +0200 Subject: [PATCH] go/printer: comment is equal to comments[cindex-1], not comments[cindex] Change-Id: I18ee1120c4c179d3c8fd02cc95d8e221a610da0a --- src/go/printer/printer.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/go/printer/printer.go b/src/go/printer/printer.go index 32be3d67dd..5a6127c6b4 100644 --- a/src/go/printer/printer.go +++ b/src/go/printer/printer.go @@ -45,9 +45,9 @@ const ( ) type commentInfo struct { - cindex int // current comment index - comment *ast.CommentGroup // = printer.comments[cindex]; or nil - commentOffset int // = printer.posFor(printer.comments[cindex].List[0].Pos()).Offset; or infinity + cindex int // index of the next comment + comment *ast.CommentGroup // = printer.comments[cindex-1]; or nil + commentOffset int // = printer.posFor(printer.comments[cindex-1].List[0].Pos()).Offset; or infinity commentNewline bool // true if the comment group contains newlines }