Docs don't match source code?

xuanbao · 2017-04-23 03:00:09 · 622 次点击    
这是一个分享于 2017-04-23 03:00:09 的资源,其中的信息可能已经有所发展或是发生改变。

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 https://golang.org/pkg/time/#example_After

func After(d Duration) <-chan Time

in the actual source code, it looks like this:

func (t Time) After(u Time) bool 

Why don't I see the definition that looks more like the docs with channels? Am I looking at the wrong thing?

https://github.com/golang/go/blob/master/src/time/time.go


评论:

anossov:

Yes, you're looking at (Time) After

time.After is in sleep.go

You can click on the function name in the docs to go to the source.

lems2:

thanks! I wasn't even aware you could click on function names! they really need to make it look like a link or something

djherbis:

One hint that looks reliable is underline on hover.

anossov:

Everything that's blue is a link.

TheMerovius:

No, this is wrong, specifically for godoc. Looking, for example, at this, 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.

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.


入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

622 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传