doukuipei9938 2015-08-02 05:49
浏览 78
已采纳

godoc不显示源代码

I got several Go projects which is documented compatibly with godoc. We use godoc to share doc and code internally as a doc server without significant problem. However we need more control on opening code when we want to share doc with 3rd party. Is there a way to run godoc in a special mode that showing types and docs but never link to or showing source code?

I've tried

godoc -http=0.0.0.0:8090 -links=false -src=false

but not working, still can link to type definition code. Just wondering if missed sth. Go version, 1.3.

  • 写回答

1条回答 默认 最新

  • dro7152 2015-08-02 06:21
    关注

    The src file only refers to command line mode, not to server mode, so it won't help you. The way I see it there are a few options:

    1. Rewrite godoc for your needs and use your own fork.

    2. Don't use the server mode, render the docs in command line mode and just create a server out of that.

    3. Better yet (I'm not entirely sure 2 will work) - rewrite the templates a bit so the source code won't be linked. But you'll still need to make sure people who enter the path manually won't see the code so it will require fudging the source templates as well. or...

    4. Maybe the simplest thing - run it behind nginx or a similar reverse proxy, and make sure the /src path in the server is closed to outside visitors, or password protected or whatever. That way your internal team can still use it.

    Personally I'd go with 4, it's a couple minutes of work and will be the most robust and flexible solution.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 滑块验证码移动速度不一致问题
  • ¥15 定制ai直播实时换脸软件
  • ¥100 栈回溯相关,模块加载后KiExceptionDispatch无法正常回溯了
  • ¥15 Utunbu中vscode下cern root工作台中写的程序root的头文件无法包含
  • ¥15 麒麟V10桌面版SP1如何配置bonding
  • ¥15 Marscode IDE 如何预览新建的 HTML 文件
  • ¥15 K8S部署二进制集群过程中calico一直报错
  • ¥15 java python或者任何一种编程语言复刻一个网页
  • ¥20 如何通过代码传输视频到亚马逊平台
  • ¥15 php查询mysql数据库并显示至下拉列表中