3 ms·
In Go, a folder is a package and as soon as you write a comment before the `package foo` declaration, it's package documentation. And thus GoDoc automatically g
by PhilippGille 7y ago
In Go, a folder is a package and as soon as you write a comment before the `package foo` declaration, it's package documentation. And thus GoDoc automatically generates a nice webpage out of it.
See for example this package comment: https://github.com/golang/go/blob/master/src/net/http/doc.go#L6-L104 https://github.com/golang/go/blob/master/src/net/http/doc.go...
Turns into this documentation (the beginning only): https://godoc.org/net/http https://godoc.org/net/http
Out of the box.
- omarhaneef 7y agoNice. I like the way it also shows you the functions inside a file/folder, and that clickable index is nice.
- heyoni 7y agoWhat's the point of all these empty comments throughout the code? // ...
- hazz99 7y agoIt's likely the Go libter requiring every public method / variable to be documented.
- inlined 7y agoYup. I saw a lot of codebases with things like: // EnqueueEvent ... func (q *Queue)EnqueueEvent(event Event)
- patrickmcnamara 7y agoIt's just an ellipsis indicating that there be would more code after.