Skip to content

Commit

Permalink
sync gofmt.go with Go 1.18rc1
Browse files Browse the repository at this point in the history
Mainly to include the work that Bryan Mills and myself did in gofmt
to make it format multiple files concurrently,
resulting in a 3-4x speedup on my 8-core laptop.

Note that this also includes the later change to limit to 200
concurrently open file descriptors, to avoid "too many open files"
errors on some systems.

Also note that we reverted gofmt's transition from interface{} to "any",
as we still want to support Go 1.16 and 1.17.

Update the README to clarify what version of gofmt we're based on.

While here, also update generated.txt to test that gofmt still applies
to implicitly walked generated files, and that stdin is considered an
explicitly given file.
  • Loading branch information
mvdan committed Feb 20, 2022
1 parent 6b39b9e commit 99c3b4c
Show file tree
Hide file tree
Showing 6 changed files with 323 additions and 65 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

go install mvdan.cc/gofumpt@latest

Enforce a stricter format than `gofmt`, while being backwards compatible. That
is, `gofumpt` is happy with a subset of the formats that `gofmt` is happy with.
Enforce a stricter format than `gofmt`, while being backwards compatible.
That is, `gofumpt` is happy with a subset of the formats that `gofmt` is happy with.

The tool is a modified fork of `gofmt`, so it can be used as a drop-in
replacement. Running `gofmt` after `gofumpt` should be a no-op. For example:
The tool is a modified fork of `gofmt` as of Go 1.18rc1.
It can be used as a drop-in replacement to format your Go code,
and running `gofmt` after `gofumpt` should produce no changes.
For example:

gofumpt -l -w .

Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ require (
github.com/google/go-cmp v0.5.6
github.com/rogpeppe/go-internal v1.8.1
golang.org/x/mod v0.5.1
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/sys v0.0.0-20211213223007-03aa0b5f6827
golang.org/x/tools v0.1.8
)
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Expand Down
Loading

0 comments on commit 99c3b4c

Please sign in to comment.