Questions tagged [godoc]

GoDoc hosts documentation for Go packages on Bitbucket, GitHub, Google Project Hosting and Launchpad. It can extract and generate documentation for Go programs.

Godoc extracts and generates documentation for Go programs.

Godoc parses Go source code - including comments - and produces documentation as HTML or plain text. The end result is documentation tightly coupled with the code it documents. For example, through godoc's web interface you can navigate from a function's documentation to its implementation with one click.

It has two modes.

Without the -http flag, it runs in command-line mode and prints plain text documentation to standard output and exits. If both a library package and a command with the same name exists, using the prefix cmd/ will force documentation on the command rather than the library package. If the -srcflag is specified, godoc prints the exported interface of a package in Go source form, or the implementation of a specific exported language entity.

References :

http://godoc.org/golang.org/x/tools/cmd/godoc

81 questions
0
votes
1 answer

SIMPLE godoc Hello world

Trying to serve a godoc on a simple, flat code folder. The online docs do not explain how to achieve this SIMPLE task. So, creating this simple structure, /tmp/testgodoc$ tree . └── src ├── main (just the binary) └── main.go 1 directory, 2…
ymudyruc
  • 77
  • 9
0
votes
1 answer

Is it possible to create visible documentation for package in go?

How to create visible Go documentation? That is easy to create documentation for any function in go like that: package main // documentation example func DocumentedFunction() bool { return true } And i can see that documentation when i call…
dancheg
  • 549
  • 1
  • 4
  • 14
0
votes
1 answer

Can godoc tool hide constants and variables content?

I want to write some document for my program and use godoc to generate a html document page. However, it reveals some exported constants and variables. They are exportable because other packages in this program need them. But it is unnecessary for a…
kun uran
  • 19
  • 1
0
votes
1 answer

How to use godoc to open the docs for your current package?

I want to display the docs only for a package. I've tried godoc github.com/user/repo as other answers says but I get the following error: $ godoc github.com/user/repo Unexpected arguments. Use "go doc" for command-line help output instead. For…
akko
  • 559
  • 3
  • 8
  • 17
0
votes
1 answer

Godooc won't read my code, or godoc can't read anonymouse function?

Recently I tried to document my code, but I had some trouble using godoc because there's some function that didn't came up when I ran godoc -http:localhost:6060 This is what my code looks like: type MongoDBInterface interface { …
0
votes
1 answer

How to quick navigate through all interfaces on godoc site

Is there any way to quick navigate through all interfaces in a package? On godoc.org, now pkg.go.dev, there isn't an "interface" type in the documentation index. The in-page navigate interface recognizes interface as no type. So currently I'm using…
Zhwt
  • 426
  • 3
  • 13
0
votes
1 answer

How to document my service endpoint with goDoc that accepts multipart/form-data

I have a service written in Go/Gin where I accept multipart/form-data to accept a list of files from the user. The code looks like this. func UploadScreenshotsHandler(c *gin.Context) { //Multipart form form, err := c.MultipartForm() if…
Zhen Liu
  • 7,550
  • 14
  • 53
  • 96
0
votes
1 answer

Windows hidden godoc

I am having problems starting a godoc server hidden on my windows development machine. The idea is to have a batch that starts godoc and opens it in my browser. So far that works, but I cannot get rid of a console window holding the godoc output…
user2089648
  • 1,356
  • 2
  • 17
  • 31
0
votes
2 answers

How to force Windows godoc to update private package documentation on local webserver in golang?

How can I force godoc to update my private package documentation when running a local godoc webserver on Windows? Running the command: "godoc -http :6060" on Windows doesn't update new godoc comments in private packages. When I first ran the…
ddrake12
  • 831
  • 11
  • 22
0
votes
1 answer

How to access unexported functions in the same package but from different file

I am trying to build godoc.org source code in my local to make some changes. My working directory is /Users/Dany/go/src/github.com/golang/gddo. In gddo-server package there several files. One of the go file uses a function from another file which is…
Dany
  • 2,692
  • 7
  • 44
  • 67
0
votes
2 answers

How can I jump to the documentation of the type of a field in a struct or a method I'm browsing in godoc?

I'm still struggling to word the question in a way that is quick to understand, so I'll instead document the steps I followed to encounter the issue I am facing. I am looking up documentation for the Request struct in net/http package. I do this…
wingedrhino
  • 162
  • 1
  • 2
  • 8
0
votes
0 answers

godoc no match found error

I am new to Go and am writing a test application and would like to document it. My application is in GOHOME\src\myapp. I could use the following command to start a server and use a browser to view the documents. This worked: $ godoc…
George Meng
  • 23
  • 1
  • 4
0
votes
1 answer

Why doesn't godoc skip examples in golang?

I was trying to make a documentation and provide examples but I didn't understand how to because godoc was skipping my examples. when I go to localhost:8080/pkg/hello_example on the browser it print on the terminal: 2014/07/01 15:54:29 skipping…
Charlie Parker
  • 5,884
  • 57
  • 198
  • 323
0
votes
3 answers

How to run godoc on some popular go repo?

New godoc have some nice features like list of callers etc. Anyway I have problems to run it, like: ➜ ~GOPATH git:(master) ✗ ls src/github.com/coreos/etcd/ CHANGELOG DCO Documentation README.md bench build …
Sławosz
  • 11,187
  • 15
  • 73
  • 106
-1
votes
1 answer

How to install static content removed from golang with go 1.13

Before go 1.13, I could run the version of godoc that came with go as godoc -http localhost:6060. This would not only show me the documentation for all of my source code, but also static content from the go web page, including for example the go…
user3188445
  • 4,062
  • 16
  • 26