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 请看一下,学校实验要求,我需要具体代码
  • ¥50 pc微信3.6.0.18不能登陆 有偿解决问题
  • ¥20 MATLAB绘制两隐函数曲面的交线
  • ¥15 求TYPCE母转母转接头24PIN线路板图
  • ¥100 国外网络搭建,有偿交流
  • ¥15 高价求中通快递查询接口
  • ¥15 解决一个加好友限制问题 或者有好的方案
  • ¥15 急matlab编程仿真二阶震荡系统
  • ¥20 TEC-9的数据通路实验
  • ¥15 ue5 .3之前好好的现在只要是激活关卡就会崩溃