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 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)