From 430ae97a2599e840bdeb934d5be171efb4a41272 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20Mart=C3=AD?= Date: Thu, 21 Apr 2022 14:06:20 +0100 Subject: [PATCH] go/format: skip go/ast's object resolution MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Just like https://golang.org/cl/401454 removed the work from gofmt for a nice ~5% speed-up in the default case, we can also use the option in the equivalent go/format for programs which use it rather than gofmt, as go/format makes no use of objects either. No benchmark numbers as we already measured the ~5% speed-up with gofmt in the other CL linked above. See #46485. Change-Id: Icbf98e6d46a616081314e2faa13f1dfade3bbaef Reviewed-on: https://go-review.googlesource.com/c/go/+/401474 Run-TryBot: Daniel Martí TryBot-Result: Gopher Robot Reviewed-by: Bryan Mills Reviewed-by: Ian Lance Taylor --- src/go/format/format.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/go/format/format.go b/src/go/format/format.go index fb87e84a4e..3837cb4617 100644 --- a/src/go/format/format.go +++ b/src/go/format/format.go @@ -38,7 +38,7 @@ const ( var config = printer.Config{Mode: printerMode, Tabwidth: tabWidth} -const parserMode = parser.ParseComments +const parserMode = parser.ParseComments | parser.SkipObjectResolution // Node formats node in canonical gofmt style and writes the result to dst. // -- 2.48.1