Skip to content

Commit

Permalink
go/format: skip go/ast's object resolution
Browse files Browse the repository at this point in the history
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í <mvdan@mvdan.cc>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
  • Loading branch information
mvdan committed Apr 21, 2022
1 parent f5af1e8 commit 430ae97
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/go/format/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//
Expand Down

0 comments on commit 430ae97

Please sign in to comment.