<p>Hey guys I'm learning go and it's very exciting! one thing that I don't understand is how time.After works. In the docs this is the definition <a href="https://golang.org/pkg/time/#example_After" rel="nofollow">https://golang.org/pkg/time/#example_After</a></p>
<pre><code>func After(d Duration) <-chan Time
</code></pre>
<p>in the actual source code, it looks like this:</p>
<pre><code>func (t Time) After(u Time) bool
</code></pre>
<p>Why don't I see the definition that looks more like the docs with channels? Am I looking at the wrong thing?</p>
<p><a href="https://github.com/golang/go/blob/master/src/time/time.go" rel="nofollow">https://github.com/golang/go/blob/master/src/time/time.go</a></p>
<hr/>**评论:**<br/><br/>anossov: <pre><p>Yes, you're looking at <a href="https://golang.org/pkg/time/#Time.After" rel="nofollow">(Time) After</a></p>
<p>time.After is in <a href="https://golang.org/src/time/sleep.go?s=4766:4800#L140" rel="nofollow">sleep.go</a></p>
<p>You can click on the function name in the docs to go to the source.</p></pre>lems2: <pre><p>thanks! I wasn't even aware you could click on function names! they really need to make it look like a link or something</p></pre>djherbis: <pre><p>One hint that looks reliable is underline on hover.</p></pre>anossov: <pre><p>Everything that's blue is a link.</p></pre>TheMerovius: <pre><p>No, this is wrong, specifically for godoc. Looking, for example, at <a href="https://golang.org/pkg/net/http/" rel="nofollow">this</a>, the global Header isn't a link, the section headers aren't, the "type/func" parts of headers aren't, neither are the receiver parts of the headers.</p>
<p>I agree that, personally, I never found it hard to identify links in the doc, but you shouldn't shut down someone who does by saying "everything that's blue", especially if it's not even correct.</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传