dougan5772 2017-09-24 16:11
浏览 353
已采纳

了解是否需要将.go文件放在pkg文件夹下? [关闭]

It's very often I see .go files committed to pkg folder, like here https://github.com/kubernetes/apiserver what particular reason doing that vs using vendor folder for 3rdparty dependencies or commit your own code into src dir?

  • 写回答

2条回答 默认 最新

  • duanpie4763 2017-09-24 16:56
    关注

    Please clarify further.

    • The pkg folder on that repo you linked is where they put the packages they wrote. Reason? well they need to put them somewhere, they chose pkg.

    • You use vendor folder when you don't want future changes to 3rd party packages you've used possibly make your program unstable, in that case you "vendor" those 3rd party packages. So you don't put your own packages in vendor folder for obvious reasons.

    • Which src? $GOPATH/src? you can do it! probably, I haven't test it. But you can only have one project in that case, and that's the project that you've placed there.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 爬虫爬取网站的一些信息
  • ¥15 关于vue2中methods使用call修改this指向的问题
  • ¥15 idea自动补全键位冲突
  • ¥15 请教一下写代码,代码好难
  • ¥15 iis10中如何阻止别人网站重定向到我的网站
  • ¥15 滑块验证码移动速度不一致问题
  • ¥15 Utunbu中vscode下cern root工作台中写的程序root的头文件无法包含
  • ¥15 麒麟V10桌面版SP1如何配置bonding
  • ¥15 Marscode IDE 如何预览新建的 HTML 文件
  • ¥15 K8S部署二进制集群过程中calico一直报错