]> Cypherpunks repositories - gostls13.git/commit
cmd/doc: fix merging comments in -src mode
authorIvan Trubach <mr.trubach@icloud.com>
Thu, 12 Dec 2019 13:33:42 +0000 (13:33 +0000)
committerRob Pike <r@golang.org>
Thu, 5 Mar 2020 03:55:11 +0000 (03:55 +0000)
commit585e31df63f6879c03b285711de6f9dcba1f2cb0
tree3220132abde465352a7355245fe9cf9876a681e2
parentbfb903f2521ff24639aa7a5219330df38b06f412
cmd/doc: fix merging comments in -src mode

These changes fix go doc -src mode that vomits comments from random files if
filesystem does not sort files by name. The issue was with parse.ParseDir
using the Readdir order of files, which varies between platforms and filesystem
implementations. Another option is to merge comments using token.FileSet.Iterate
order in cmd/doc, but since ParseDir is mostly used in go doc, I’ve opted for
smaller change because it’s unlikely to break other uses or cause any perfomance
issues.

Example (macOS APFS): `go doc -src net.ListenPacket`

Change-Id: I7f9f368c7d9ccd9a2cbc48665f2cb9798c7b3a3f
GitHub-Last-Rev: 654fb450421266a0bb64518016944db22bd681e3
GitHub-Pull-Request: golang/go#36104
Reviewed-on: https://go-review.googlesource.com/c/go/+/210999
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
src/cmd/doc/doc_test.go
src/cmd/doc/testdata/merge/aa.go [new file with mode: 0644]
src/cmd/doc/testdata/merge/bb.go [new file with mode: 0644]
src/go/parser/interface.go