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
x/tools/godoc: Anchors for variables and constants no longer added #19894
Comments
There was nothing in Go 1.8.1 changing godoc. Or do you mean before Go 1.8? Even then, I don't think this is true. We added #anchors in Go 1.8 but didn't change or remove any. |
Ah, you're right. The change seems to have happened with the 1.8 release, not 1.8.1. If you go to this snapshot from Feb 2017 (Go 1.7.5) you'll be able to jump to the TypeBlock constant: https://web.archive.org/web/20170211005446/https://golang.org/pkg/archive/tar/#TypeBlock. This doesn't work with the live version anymore: https://golang.org/pkg/archive/tar/#TypeBlock. Notice the There's no more |
I bisected The problem starts with golang/tools@e1bdc76. With the parent commit, the generated HTML looks like this: With golang/tools@e1bdc76, you get: I'm not up to date with how /cc @jayconrod |
Here's a diff of the generated HTML at localhost:6060/pkg/archive/tar/: @@ -333,40 +333,40 @@
<p>
Header type flags.
</p>
<pre>const (
- <span id="TypeReg">TypeReg</span> = '0' <span class="comment">// regular file</span>
- <span id="TypeRegA">TypeRegA</span> = '\x00' <span class="comment">// regular file</span>
- <span id="TypeLink">TypeLink</span> = '1' <span class="comment">// hard link</span>
- <span id="TypeSymlink">TypeSymlink</span> = '2' <span class="comment">// symbolic link</span>
- <span id="TypeChar">TypeChar</span> = '3' <span class="comment">// character device node</span>
- <span id="TypeBlock">TypeBlock</span> = '4' <span class="comment">// block device node</span>
- <span id="TypeDir">TypeDir</span> = '5' <span class="comment">// directory</span>
- <span id="TypeFifo">TypeFifo</span> = '6' <span class="comment">// fifo node</span>
- <span id="TypeCont">TypeCont</span> = '7' <span class="comment">// reserved</span>
- <span id="TypeXHeader">TypeXHeader</span> = 'x' <span class="comment">// extended header</span>
- <span id="TypeXGlobalHeader">TypeXGlobalHeader</span> = 'g' <span class="comment">// global extended header</span>
- <span id="TypeGNULongName">TypeGNULongName</span> = 'L' <span class="comment">// Next file has a long name</span>
- <span id="TypeGNULongLink">TypeGNULongLink</span> = 'K' <span class="comment">// Next file symlinks to a file w/ a long name</span>
- <span id="TypeGNUSparse">TypeGNUSparse</span> = 'S' <span class="comment">// sparse file</span>
+ TypeReg = '0' <span class="comment">// regular file</span>
+ TypeRegA = '\x00' <span class="comment">// regular file</span>
+ TypeLink = '1' <span class="comment">// hard link</span>
+ TypeSymlink = '2' <span class="comment">// symbolic link</span>
+ TypeChar = '3' <span class="comment">// character device node</span>
+ TypeBlock = '4' <span class="comment">// block device node</span>
+ TypeDir = '5' <span class="comment">// directory</span>
+ TypeFifo = '6' <span class="comment">// fifo node</span>
+ TypeCont = '7' <span class="comment">// reserved</span>
+ TypeXHeader = 'x' <span class="comment">// extended header</span>
+ TypeXGlobalHeader = 'g' <span class="comment">// global extended header</span>
+ TypeGNULongName = 'L' <span class="comment">// Next file has a long name</span>
+ TypeGNULongLink = 'K' <span class="comment">// Next file symlinks to a file w/ a long name</span>
+ TypeGNUSparse = 'S' <span class="comment">// sparse file</span>
)</pre>
<h2 id="pkg-variables">Variables</h2>
<pre>var (
- <span id="ErrWriteTooLong">ErrWriteTooLong</span> = <a href="/pkg/errors/">errors</a>.<a href="/pkg/errors/#New">New</a>("archive/tar: write too long")
- <span id="ErrFieldTooLong">ErrFieldTooLong</span> = <a href="/pkg/errors/">errors</a>.<a href="/pkg/errors/#New">New</a>("archive/tar: header field too long")
- <span id="ErrWriteAfterClose">ErrWriteAfterClose</span> = <a href="/pkg/errors/">errors</a>.<a href="/pkg/errors/#New">New</a>("archive/tar: write after close")
+ ErrWriteTooLong = <a href="/pkg/errors/">errors</a>.<a href="/pkg/errors/#New">New</a>("archive/tar: write too long")
+ ErrFieldTooLong = <a href="/pkg/errors/">errors</a>.<a href="/pkg/errors/#New">New</a>("archive/tar: header field too long")
+ ErrWriteAfterClose = <a href="/pkg/errors/">errors</a>.<a href="/pkg/errors/#New">New</a>("archive/tar: write after close")
)</pre>
<pre>var (
- <span id="ErrHeader">ErrHeader</span> = <a href="/pkg/errors/">errors</a>.<a href="/pkg/errors/#New">New</a>("archive/tar: invalid tar header")
+ ErrHeader = <a href="/pkg/errors/">errors</a>.<a href="/pkg/errors/#New">New</a>("archive/tar: invalid tar header")
)</pre>
@@ -409,11 +409,11 @@
<h3 id="FileInfoHeader">func <a href="/src/archive/tar/common.go?s=5687:5752#L189">FileInfoHeader</a>
<a class="permalink" href="#FileInfoHeader">¶</a>
</h3>
- <pre>func FileInfoHeader(fi <a href="/pkg/os/">os</a>.<a href="/pkg/os/#FileInfo">FileInfo</a>, link <a href="/pkg/builtin/#string">string</a>) (*<a href="#Header">Header</a>, <a href="/pkg/builtin/#error">error</a>)</pre>
+ <pre>func <a href="#FileInfoHeader">FileInfoHeader</a>(fi <a href="/pkg/os/">os</a>.<a href="/pkg/os/#FileInfo">FileInfo</a>, link <a href="/pkg/builtin/#string">string</a>) (*<a href="#Header">Header</a>, <a href="/pkg/builtin/#error">error</a>)</pre>
<p>
FileInfoHeader creates a partially-populated Header from fi.
If fi describes a symlink, FileInfoHeader records link as the link target.
If fi describes a directory, a slash is appended to the name.
Because os.FileInfo's Name method returns only the base name of
@@ -428,11 +428,11 @@
<h3 id="Header.FileInfo">func (*Header) <a href="/src/archive/tar/common.go?s=2353:2392#L56">FileInfo</a>
<a class="permalink" href="#Header.FileInfo">¶</a>
</h3>
- <pre>func (h *<a href="#Header">Header</a>) FileInfo() <a href="/pkg/os/">os</a>.<a href="/pkg/os/#FileInfo">FileInfo</a></pre>
+ <pre>func (h *<a href="#Header">Header</a>) <a href="#FileInfo">FileInfo</a>() <a href="/pkg/os/">os</a>.<a href="/pkg/os/#FileInfo">FileInfo</a></pre>
<p>
FileInfo returns an os.FileInfo for the Header.
</p>
@@ -467,11 +467,11 @@
<h3 id="NewReader">func <a href="/src/archive/tar/reader.go?s=3242:3277#L90">NewReader</a>
<a class="permalink" href="#NewReader">¶</a>
</h3>
- <pre>func NewReader(r <a href="/pkg/io/">io</a>.<a href="/pkg/io/#Reader">Reader</a>) *<a href="#Reader">Reader</a></pre>
+ <pre>func <a href="#NewReader">NewReader</a>(r <a href="/pkg/io/">io</a>.<a href="/pkg/io/#Reader">Reader</a>) *<a href="#Reader">Reader</a></pre>
<p>
NewReader creates a new Reader reading from r.
</p>
@@ -481,11 +481,11 @@
<h3 id="Reader.Next">func (*Reader) <a href="/src/archive/tar/reader.go?s=3409:3450#L95">Next</a>
<a class="permalink" href="#Reader.Next">¶</a>
</h3>
- <pre>func (tr *<a href="#Reader">Reader</a>) Next() (*<a href="#Header">Header</a>, <a href="/pkg/builtin/#error">error</a>)</pre>
+ <pre>func (tr *<a href="#Reader">Reader</a>) <a href="#Next">Next</a>() (*<a href="#Header">Header</a>, <a href="/pkg/builtin/#error">error</a>)</pre>
<p>
Next advances to the next entry in the tar archive.
</p>
<p>
io.EOF is returned at the end of the input.
@@ -497,11 +497,11 @@
<h3 id="Reader.Read">func (*Reader) <a href="/src/archive/tar/reader.go?s=22332:22377#L685">Read</a>
<a class="permalink" href="#Reader.Read">¶</a>
</h3>
- <pre>func (tr *<a href="#Reader">Reader</a>) Read(b []<a href="/pkg/builtin/#byte">byte</a>) (<a href="/pkg/builtin/#int">int</a>, <a href="/pkg/builtin/#error">error</a>)</pre>
+ <pre>func (tr *<a href="#Reader">Reader</a>) <a href="#Read">Read</a>(b []<a href="/pkg/builtin/#byte">byte</a>) (<a href="/pkg/builtin/#int">int</a>, <a href="/pkg/builtin/#error">error</a>)</pre>
<p>
Read reads from the current entry in the tar archive.
It returns 0, io.EOF when it reaches the end of that entry,
until Next is called to advance to the next entry.
</p>
@@ -543,11 +543,11 @@
<h3 id="NewWriter">func <a href="/src/archive/tar/writer.go?s=1468:1503#L36">NewWriter</a>
<a class="permalink" href="#NewWriter">¶</a>
</h3>
- <pre>func NewWriter(w <a href="/pkg/io/">io</a>.<a href="/pkg/io/#Writer">Writer</a>) *<a href="#Writer">Writer</a></pre>
+ <pre>func <a href="#NewWriter">NewWriter</a>(w <a href="/pkg/io/">io</a>.<a href="/pkg/io/#Writer">Writer</a>) *<a href="#Writer">Writer</a></pre>
<p>
NewWriter creates a new Writer writing to w.
</p>
@@ -557,11 +557,11 @@
<h3 id="Writer.Close">func (*Writer) <a href="/src/archive/tar/writer.go?s=10589:10620#L336">Close</a>
<a class="permalink" href="#Writer.Close">¶</a>
</h3>
- <pre>func (tw *<a href="#Writer">Writer</a>) Close() <a href="/pkg/builtin/#error">error</a></pre>
+ <pre>func (tw *<a href="#Writer">Writer</a>) <a href="#Close">Close</a>() <a href="/pkg/builtin/#error">error</a></pre>
<p>
Close closes the tar archive, flushing any unwritten
data to the underlying writer.
</p>
@@ -571,11 +571,11 @@
<h3 id="Writer.Flush">func (*Writer) <a href="/src/archive/tar/writer.go?s=1585:1616#L39">Flush</a>
<a class="permalink" href="#Writer.Flush">¶</a>
</h3>
- <pre>func (tw *<a href="#Writer">Writer</a>) Flush() <a href="/pkg/builtin/#error">error</a></pre>
+ <pre>func (tw *<a href="#Writer">Writer</a>) <a href="#Flush">Flush</a>() <a href="/pkg/builtin/#error">error</a></pre>
<p>
Flush finishes writing the current file (optional).
</p>
@@ -584,11 +584,11 @@
<h3 id="Writer.Write">func (*Writer) <a href="/src/archive/tar/writer.go?s=10168:10220#L314">Write</a>
<a class="permalink" href="#Writer.Write">¶</a>
</h3>
- <pre>func (tw *<a href="#Writer">Writer</a>) Write(b []<a href="/pkg/builtin/#byte">byte</a>) (n <a href="/pkg/builtin/#int">int</a>, err <a href="/pkg/builtin/#error">error</a>)</pre>
+ <pre>func (tw *<a href="#Writer">Writer</a>) <a href="#Write">Write</a>(b []<a href="/pkg/builtin/#byte">byte</a>) (n <a href="/pkg/builtin/#int">int</a>, err <a href="/pkg/builtin/#error">error</a>)</pre>
<p>
Write writes to the current entry in the tar archive.
Write returns the error ErrWriteTooLong if more than
hdr.Size bytes are written after WriteHeader.
</p>
@@ -599,11 +599,11 @@
<h3 id="Writer.WriteHeader">func (*Writer) <a href="/src/archive/tar/writer.go?s=2275:2323#L69">WriteHeader</a>
<a class="permalink" href="#Writer.WriteHeader">¶</a>
</h3>
- <pre>func (tw *<a href="#Writer">Writer</a>) WriteHeader(hdr *<a href="#Header">Header</a>) <a href="/pkg/builtin/#error">error</a></pre>
+ <pre>func (tw *<a href="#Writer">Writer</a>) <a href="#WriteHeader">WriteHeader</a>(hdr *<a href="#Header">Header</a>) <a href="/pkg/builtin/#error">error</a></pre>
<p>
WriteHeader writes hdr and prepares to accept the file's contents.
WriteHeader calls Flush if it is not the first header.
Calling after a Close will return ErrWriteAfterClose.
</p> It affects quite a few things, not just constants. Edit: Some of the changed lines have added |
@shurcooL, thanks! |
I looked into this today. After my change, I should have a fix for this tomorrow. |
Thanks! |
CL https://golang.org/cl/40300 mentions this issue. |
Reopening for cherry-pick. |
Any chance the golang.org docs could be regenerated using the fixed version of godoc? |
@Kapeli, yes, that's what I mean by "reopening for cherry-pick". |
@bradfitz, you said "reopening", but the issue continues to be closed. Is there a different meaning to the word "reopening", or did you forget to actually reopen it? |
Forgot. |
Cherry-pick doesn't apply cleanly. I've asked @jayconrod to take a look. |
golang/tools@3bcb6ef (the commit that closed this issue) is a minor patch/bug fix for golang/tools@e1bdc76, where this regression was introduced. But the corresponding issue for that commit is milestoned for Go 1.9. If it's not a part of 1.8 release, then this fixup shouldn't be needed either. |
@shurcooL, thanks! |
Confirming what @shurcooL said, this bug is not on the 1.8 branch and does not need to be cherry-picked. |
Before 1.8.1, I was able to go to https://golang.org/pkg/archive/tar/#TypeBlock and it would scroll to the relevant constant. This no longer works.
Somewhat related: this makes it impossible for Dash to index constants and variables in the Go docs.
The text was updated successfully, but these errors were encountered: