Hyperlinks that list all code files in the package Include the import statement and summary of the packageĬontains the general directory and description of constants, types, methods, and functions in the package with public visibilityĬontains a quick jump of all samples in the document In godoc, the document consists of three parts: Form We’re still from jsonvalueAccording to godoc, one by one. Go adheres to the concept of “notes are documents” and conforms to godocDocuments are extracted and generated from go code. Then enter in the browser, you can see and The same page. For example, the author’s jsonvaluePackage, I put it in this path: ~/project//Andrew-M-C/go.jsonvalue, so I was there $GOROOTThe following soft links are built: $ go env | grep GOROOT | sed 's/GOROOT=//g' | xargs cd In principle, godocPackage path read from $GOROOT。 So if you’re going to let the local godocTo understand and analyze your own development package, you should $GOROOTDirectory according to the path structure put their own project code – soft link is also supported. We can use the following command to start our own godocServices: godoc -http=127.0.0.1:6060 -playĮnter in browser that, you can see the familiar go document page: One is to solve the problem of inaccessibility in a LAN The other is that you can debug your own documents locally. and godocThe function of the command is to let us create a local godocWebsite services (official godocIn fact, it is basically built with the same tool). We can refer to the documentation of go native package. What we said earlier, is the most official document website of go.
We brought it from go godocLet’s talk about tools. Go toolkit documentation and the format associated with generating it.After the go development tool is installed, it comes with a command called godoc.Readers can click on it and compare it with the content in the code.Īddress:, first in cloud + community What is godocĪs the name implies, godoc is the document of go language. The purpose of this article is to illustrate the format of godoc through examples, so that readers can also write a paragraph on their own godoc。 The following is an example of my own jsonvalue repository. In other words, everyone can write their own godocAnd show it in On, you only need to follow the format standard of godoc, and no audit action is required. Key pointsIn The documents on are all automatically collected and formatted by go from the engineering code of open source projects. However, when I write about my wheels, I gradually find that this is not the case. As a newcomer to go language, I once thought, The above documents need to be uploaded and reviewed by developers – otherwise, they are all so professional. When doing go development, we often see such a badge on the homepage of open source projects:Ĭlick the badge to open it, which gives the go document corresponding to the open source project.