-
Notifications
You must be signed in to change notification settings - Fork 18k
x/tools/godoc: may show Go version when an identifier was modified rather than originally added #44081
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
FrozenDueToAge
NeedsFix
The path to resolution is known, but the work has not been done.
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
Comments
Change https://golang.org/cl/289089 mentions this issue: |
This is related to #37102 for pkgsite. We are planning to add this information for all packages. |
Change https://golang.org/cl/290609 mentions this issue: |
gopherbot
pushed a commit
to golang/website
that referenced
this issue
Feb 10, 2021
Bring in the godoc fix made in CL 289089 with: go get golang.org/x/tools/godoc@61406578735f11efca21e2be93800cf530d25ecb go mod tidy Fixes golang/go#44178. Updates golang/go#44081. Change-Id: Icaee037626e93e6fc5939b163760ad11873a3f0b Reviewed-on: https://go-review.googlesource.com/c/website/+/290609 TryBot-Result: Go Bot <[email protected]> Trust: Dmitri Shuralyov <[email protected]> Run-TryBot: Dmitri Shuralyov <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
henderjon
pushed a commit
to oggodoc/godoc
that referenced
this issue
Jun 13, 2024
CL 85396 implemented parsePackageAPIInfo with the idea that each identifier shows up in exactly one of api/go*.txt files, when it was added. We now know that it may show up more than once, when the signature changes (generally in a compatible way, such as when existing types are replaced with aliases to an equivalent type). Modify the algorithm to parse the api/go*.txt files in reverse order, in order to find and display the earliest Go version when each identifier was first added. Fixes golang/go#44081. Updates golang/go#5778. Change-Id: I83171fd8c161d703f284011375d74b824c279d41 Reviewed-on: https://go-review.googlesource.com/c/tools/+/289089 Run-TryBot: Dmitri Shuralyov <[email protected]> gopls-CI: kokoro <[email protected]> TryBot-Result: Go Bot <[email protected]> Trust: Dmitri Shuralyov <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
FrozenDueToAge
NeedsFix
The path to resolution is known, but the work has not been done.
Tools
This label describes issues relating to any tools in the x/tools repository.
godoc (and in turn, https://golang.org/pkg/) displays next to identifiers the version of Go when said identifier was added. This was #5778.
As reported by @benhoyt in a golang-dev thread, godoc may sometimes show that an identifier was added in a Go version too new.
This happens when a signature is modified in a later Go version. For example, the
os.Chmod
function was added in Go 1 and appears in api/go1.txt as:In Go 1.16, the
os.FileMode
type was modified (in an API compatible way: it became a type alias tofs.FileMode
), causingos.Chmod
to show up in api/go1.16.txt:(As far as I can tell from
aliasReplacer
and its comment, added tocmd/api
by @rsc in CL 243906, the api file content is working as intended; please comment otherwise.)The fix in godoc is to look for the earliest api/go*.txt file where an identifier was mentioned. I'll send a CL.
CC @ianlancetaylor, @julieqiu.
The text was updated successfully, but these errors were encountered: