golang-standards / project-layout

Standard Go Project Layout
Other
49.35k stars 5.14k forks source link

Project not found in godoc #19

Open andrealbinop opened 5 years ago

andrealbinop commented 5 years ago

Hello,

It seems godoc can't find this project. My best guess is because there's no go files in this project. However, I'm getting the same behavior in a project of mine which has go files, just not in root directory. You can see by the broken badges in README.md. Any suggestions regarding the best way to solve this? Rethink this aspect of the project structure or check with the guys in godoc to see what can be done over there?

andrealbinop commented 5 years ago

Taking a better look at other projects with the same problem, stretchr/testify created a go file just to help documentation:

https://github.com/stretchr/testify/blob/master/doc.go

I'll go with this approach for now. Couldn't this project propose something official?

kcq commented 5 years ago

GoDoc might not have a page for your root directory, but it should have pages for your sub-directories where you have Go code. I've seen it with other projects that don't have any go files in the root directory.

It's ok to have a manually created doc.go in the root directory. doc.go files are pretty common. You can also do something similar to what they do for Go itself where they dump the application help info to the alldocs.go file ( here's their shell script: https://github.com/golang/go/blob/master/src/cmd/go/mkalldocs.sh )

rcoreilly commented 5 years ago

btw I encountered the same problem, and filed an issue: https://github.com/golang/gddo/issues/618 -- also came up with the same workaround of creating a doc.go file at root level..