V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
The Go Programming Language
http://golang.org/
Go Playground
Go Projects
Revel Web Framework
darasion

godoc -http 的问题:当自定义包和标准库包重名的时候,会强制重定向到标准库包的文档。

  •  
  •   darasion · Apr 1, 2016 · 1955 views
    This topic created in 3680 days ago, the information mentioned may be changed or developed.
    想从浏览器里查看自己代码的文档,设置好 GOPATH 后,运行:

    > godoc -http=:6060

    我有个项目自己的包名字叫 rpc ,然后我尝试访问:

    http://localhost:6060/pkg/rpc

    然后被强制重定向到了:

    http://localhost:6060/pkg/net/rpc/

    --
    > curl -I http://localhost:6060/pkg/rpc
    HTTP/1.1 301 Moved Permanently
    Location: /pkg/net/rpc/
    Date: Fri, 01 Apr 2016 08:05:29 GMT
    Content-Type: text/plain; charset=utf-8

    --
    问题:
    1. godoc 是官方的支持了看用户代码文档,还是偶然不小心的能够看到用户代码文档?
    2. 如果是官方支持的话,那这个跳转是咋回事?
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1059 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 22:42 · PVG 06:42 · LAX 15:42 · JFK 18:42
    ♥ Do have faith in what you're doing.