Home  >  Article  >  Backend Development  >  How can I follow the structure of a godoc link into a comment?

How can I follow the structure of a godoc link into a comment?

PHPz
PHPzforward
2024-02-08 21:54:09443browse

如何跟踪 godoc 链接到评论中的结构?

php editor Banana introduces you a practical technique-how to track the structure of godoc links to comments. When we read godoc documents, we often encounter some links, which will jump to other pages after clicking. But sometimes we want to quickly see the specific structure those links point to, without opening a new page. This article will show you how to follow linked structures directly in comments in godoc documents with some simple steps to improve code understanding and development efficiency.

Question content

There is something wrong with my godoc installation, I'm not sure what the problem is.

What am I doing: godoc -http=:6060

I want to browse the stdlib documentation.

That was fine until I clicked on the link in the comment.

For example, in archive/tar, the reader next method has a link to filepath.islocal. When I try to click on the link I get the error:

lstat $GOROOT/path/filepath: no such file or directory

My environment variables are:

  • gopath/users/jon/go
  • goroot/usr/local/go

What should I do to navigate the document without this broken link?

Solution

Saturday 22 April 2023 15:38:23 BST

godoc The tool generates "selector expressions" to reference other packages.

A similar broken link can be found in the documentation for func (*Certificate) CheckSignatureFrom which references Certificate.Verify at http://localhost:6060/pkg/crypto/x509 /).

When encountering a "broken" link (http://localhost:6060/path/filepath#IsLocal), please add pkg/ (http://localhost: 6060/pkg/path/filepath) #IsLocal).

The above is the detailed content of How can I follow the structure of a godoc link into a comment?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:stackoverflow.com. If there is any infringement, please contact admin@php.cn delete