1

I have a Github project with README.md. For the purpose of godoc, I added doc.go file but didn't mean to include the README.md in godoc. Currently the README is showing up as the first section in godoc. Is it possible to hide the README section at all?

flaxel
  • 4,173
  • 4
  • 17
  • 30
Iblisto
  • 309
  • 2
  • 7
  • 2
    No, there is not. [File an issue](https://golang.org/s/pkgsite-feedback) to give feedback on their decision to change how package documentation should be structured. – Charlie Tumahai Apr 24 '21 at 17:21

2 Answers2

3

I found a good solution for this, simply put your README.md file in a docs folder on Github and it will not show up in the godoc, but still display on Github.

I did this for my project on Github and you can see the godoc does not show the README.mdcontent.

EDIT:

After making the appropriate changes to your github repository, you will need to publish a new patch version to get pkg.go.dev to update with the changes.

ddrake12
  • 831
  • 11
  • 22
  • I could've sworn it did as you said, but for some reason now the README's showing up on godoc again: https://github.com/sanggonlee/pogo – Iblisto Aug 14 '21 at 13:22
  • @Iblisto you probably just need to force `pkg.go.dev` to update. I think I've done this in the past using `go get` but if you look here apparently you can hit a URL as well: https://github.com/golang/go/issues/38848. Let me know if this works and I will update my answer with this information – ddrake12 Aug 15 '21 at 16:23
  • @Iblisto I had some time and tried playing around with this but couldn't get it to update on `pkg.go.dev` using any method. You may need to publish a patch version (v1.0.1) to get it to update. Can you try that? – ddrake12 Aug 17 '21 at 16:20
  • 1
    Ahh that seems to have worked! Sorry I probably wasn't thinking right. Thank you! – Iblisto Aug 27 '21 at 13:12
1

Is it possible to hide the README section at all?

No. Unless you omit that file or rename it.

Volker
  • 40,468
  • 7
  • 81
  • 87