Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/doc: -src flag misbehaves on some systems [1.14 backport] #38993
Under go1.14.2, if you run
Commit 585e31d fixes this issue, but it is not applied in the current release (go1.14.2). It would be great to get this trivial fix cherry picked into the next point release.
(Apologies if I should be using @gopherbot to create this issue; I would have but there wasn't a corresponding issue for the original fix.)
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` Fixes #38993 Change-Id: I7f9f368c7d9ccd9a2cbc48665f2cb9798c7b3a3f GitHub-Last-Rev: 654fb45 GitHub-Pull-Request: #36104 Reviewed-on: https://go-review.googlesource.com/c/go/+/210999 Run-TryBot: Rob Pike <email@example.com> TryBot-Result: Gobot Gobot <firstname.lastname@example.org> Reviewed-by: Rob Pike <email@example.com> (cherry picked from commit 585e31d) Reviewed-on: https://go-review.googlesource.com/c/go/+/235579 Run-TryBot: Andrew Bonventre <firstname.lastname@example.org> Reviewed-by: Andrew Gerrand <email@example.com>